第三方GUI库"/>
第三方GUI库
Python 第三方GUI库- gooey
from gooey import Gooey
from gooey import GooeyParser@Gooey(program_name="BattCommunicate_GUI", language="chinese")
def gui_main():parser = GooeyParser(description="BattCommunicate_GUI")sublist_parser = parser.add_subparsers(dest="RESULT") # 创建一个可生成多 parser的 subparsers对象prs1 = sublist_parser.add_parser("test_result") # 第一个子parserprs1.add_argument("end_result", widget="Dropdown", metavar="测试结果", choices=["PASS", "FAIL"])subparser2 = sublist_parser.add_parser("test_time") # 第二个子parsersubparser2.add_argument("times_d", metavar="测试时间", widget="Dropdown", choices=[">100s", ">200s"],default=">100s")prs2 = sublist_parser.add_parser('员工记录')prs2.add_argument("date",widget='DateChooser')prs2.add_argument('Dropdown',widget='Dropdown',choices=['A','B','C'],default='C')prs2.add_argument('dir', widget="FilterableDropdown", help="下载路径")args = parser.parse_args()# if args.Dropdown == 'A':# temp01= ['AA','AB','BC']# else:# temp01= ['BB','BC','BD']# prs2.dir(choices= temp01)print(args)if args.RESULT == "test_time": # 判断是执行哪个parserif args.times_d == ">100s": # 判断parser下参数输出print(">>> 测试时间 大于100s")else:print(">>> 测试时间 大于200s")if args.RESULT == "timest_result":if args.end_result == "PASS":print(">>> 测试成功~!")else:print(">>> ERROR: 测试失败~")if args.RESULT == "员工记录":print(args.date)print(args.Dropdown)if __name__ == '__main__':gui_main()
def Gooey(f=None,
advanced=True,
language=‘english’,
auto_start=False, # TODO: add this to the docs. Used to be show_config=True
target=None,
program_name=None,
program_description=None,
default_size=(610, 530),
use_legacy_titles=True,
required_cols=2,
optional_cols=2,
dump_build_config=False,
load_build_config=None,
monospace_display=False, # TODO: add this to the docs
image_dir=‘::gooey/default’,
language_dir=getResourcePath(‘languages’),
progress_regex=None, # TODO: add this to the docs
progress_expr=None, # TODO: add this to the docs
hide_progress_msg=False, # TODO: add this to the docs
disable_progress_bar_animation=False,
disable_stop_button=False,
group_by_type=True,
header_height=80,
navigation=‘SIDEBAR’, # TODO: add this to the docs
tabbed_groups=False,
use_cmd_args=False,
**kwargs):
defaults = {
‘advanced’: True,
‘language’: ‘english’,
‘auto_start’: False, # TODO: add this to the docs. Used to be show_config=True
‘target’: None,
‘program_name’: None,
‘program_description’: None,
‘default_size’: (610, 530),
‘use_legacy_titles’: True,
‘required_cols’: 2,
‘optional_cols’: 2,
‘dump_build_config’: False,
‘load_build_config’: None,
‘monospace_display’: False, # TODO: add this to the docs
‘image_dir’: ‘::gooey/default’,
‘language_dir’: getResourcePath(‘languages’),
‘progress_regex’: None, # TODO: add this to the docs
‘progress_expr’: None, # TODO: add this to the docs
‘hide_progress_msg’: False, # TODO: add this to the docs
‘disable_progress_bar_animation’: False,
‘disable_stop_button’: False,
‘group_by_type’: True,
‘header_height’: 80,
‘navigation’: ‘SIDEBAR’, # TODO: add this to the docs
‘tabbed_groups’: False,
‘use_cmd_args’: False,
‘timing_options’: {
‘show_time_remaining’: False,
‘hide_time_remaining_on_complete’: True
}
}
更多推荐
第三方GUI库
发布评论