From 337aa9d267540160a84f6bc6cabf001f8faf579c Mon Sep 17 00:00:00 2001 From: Nathan Richard Date: Fri, 15 Nov 2019 16:32:41 +0100 Subject: [PATCH] Added an example for the new "collapsible group" feature. --- examples/groups_demo.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 examples/groups_demo.py diff --git a/examples/groups_demo.py b/examples/groups_demo.py new file mode 100644 index 0000000..7c40159 --- /dev/null +++ b/examples/groups_demo.py @@ -0,0 +1,41 @@ +''' +A simple Gooey example. One required field, one optional. +''' + +from gooey import Gooey, GooeyParser + + +@Gooey() +def main(): + parser = GooeyParser(description='Log into webservice.') + userIDGroup = parser.add_argument_group("UserID") + + userIDGroup.add_argument( + '--login', + metavar='Username', + type=str, + help='Enter you email address.') + + userIDGroup.add_argument( + '--pwd', + metavar='Password', + type=str, + help='Enter your password', + widget="PasswordField") + + advSettingsGroup = parser.add_argument_group( + "Advanced Settings", + gooey_options={"collapsible": True}) + + advSettingsGroup.add_argument( + "--serviceUrl", + metavar="Web service URL", + type=str, + help="Enter the url of the webservice you want to connect to.") + + args = parser.parse_args() + print('Connected!') + + +if __name__ == '__main__': + main()