forked from shimpe/argparseui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example2.py
executable file
·21 lines (18 loc) · 737 Bytes
/
example2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3
import argparse
import sys
from PyQt5 import QtWidgets
import argparseui
def do_something(argparseuiinstance):
options = argparseuiinstance.parse_args()
print ("Options: ", options)
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--make-argument-true", help="optional boolean argument", action="store_true")
parser.add_argument("-o","--make-other-argument-true", help="optional boolean argument 2", action="store_true", default=True)
app = QtWidgets.QApplication(sys.argv)
a = argparseui.ArgparseUi(parser,use_save_load_button=True,ok_button_handler=do_something)
a.show()
app.exec_()
if a.result() != 1:
# Do what you like with the arguments...
print ("Cancel pressed")