{"action":"created","issue":{"url":"https://api.github.com/repos/chriskiehl/Gooey/issues/86","labels_url":"https://api.github.com/repos/chriskiehl/Gooey/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/chriskiehl/Gooey/issues/86/comments","events_url":"https://api.github.com/repos/chriskiehl/Gooey/issues/86/events","html_url":"https://github.com/chriskiehl/Gooey/issues/86","id":69726361,"number":86,"title":"GooeyParser does not launch a GUI","user":{"login":"ecsellon","id":12015503,"avatar_url":"https://avatars.githubusercontent.com/u/12015503?v=3","gravatar_id":"","url":"https://api.github.com/users/ecsellon","html_url":"https://github.com/ecsellon","followers_url":"https://api.github.com/users/ecsellon/followers","following_url":"https://api.github.com/users/ecsellon/following{/other_user}","gists_url":"https://api.github.com/users/ecsellon/gists{/gist_id}","starred_url":"https://api.github.com/users/ecsellon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecsellon/subscriptions","organizations_url":"https://api.github.com/users/ecsellon/orgs","repos_url":"https://api.github.com/users/ecsellon/repos","events_url":"https://api.github.com/users/ecsellon/events{/privacy}","received_events_url":"https://api.github.com/users/ecsellon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-04-21T02:32:48Z","updated_at":"2015-04-24T12:48:38Z","closed_at":"2015-04-21T03:52:18Z","body":"Here's the test program:\r\n\r\n```python\r\nfrom gooey import GooeyParser\r\n\r\ndef main():\r\n    clParser = GooeyParser(description = 'Test program')\r\n    clParser.add_argument('filename', help = 'name of the file to process')\r\n    args = clParser.parse_args()\r\n    print args\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n```\r\n\r\nNo GUI pops up. Output:\r\n\r\n```\r\n>gooeyTest.py\r\nusage: gooeyTest.py [-h] filename\r\ngooeyTest.py: error: too few arguments\r\n```"},"comment":{"url":"https://api.github.com/repos/chriskiehl/Gooey/issues/comments/95922436","html_url":"https://github.com/chriskiehl/Gooey/issues/86#issuecomment-95922436","issue_url":"https://api.github.com/repos/chriskiehl/Gooey/issues/86","id":95922436,"user":{"login":"krisztianfekete","id":1246751,"avatar_url":"https://avatars.githubusercontent.com/u/1246751?v=3","gravatar_id":"","url":"https://api.github.com/users/krisztianfekete","html_url":"https://github.com/krisztianfekete","followers_url":"https://api.github.com/users/krisztianfekete/followers","following_url":"https://api.github.com/users/krisztianfekete/following{/other_user}","gists_url":"https://api.github.com/users/krisztianfekete/gists{/gist_id}","starred_url":"https://api.github.com/users/krisztianfekete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krisztianfekete/subscriptions","organizations_url":"https://api.github.com/users/krisztianfekete/orgs","repos_url":"https://api.github.com/users/krisztianfekete/repos","events_url":"https://api.github.com/users/krisztianfekete/events{/privacy}","received_events_url":"https://api.github.com/users/krisztianfekete/received_events","type":"User","site_admin":false},"created_at":"2015-04-24T12:48:38Z","updated_at":"2015-04-24T12:48:38Z","body":"Sorry for the many (and long) comments, I still think they are relevant, this one will be the last:\r\n\r\nI admit, that having `@Gooey` optional for `GooeyParser` is almost all that is needed, and `@Gooey` decorator is not that bad if used only for parameter passing for code, where `ArgumentParser` is basically a singleton class, but I'd still prefer a solution more respectful to `ArgumentParser`  (no [monkey](https://github.com/chriskiehl/Gooey/blob/5220b4a1396a5d87e1fb011b35e94eb7610c505f/gooey/python_bindings/gooey_decorator.py#L70) [patching](https://github.com/chriskiehl/Gooey/blob/5220b4a1396a5d87e1fb011b35e94eb7610c505f/gooey/python_bindings/gooey_decorator.py#L121)).\r\n\r\nWhat about this API for advanced users?\r\n\r\n```python\r\n# user code\r\nimport gooey\r\nArgumentParser = gooey.get_parser_class(\r\n    advanced=Boolean,          # toggle whether to show advanced config or not \r\n    language=language_string,  # Translations configurable via json\r\n    show_config=True,          # skip config screens all together\r\n    program_name='name',       # Defaults to script name\r\n    program_description,       # Defaults to ArgParse Description\r\n    default_size=(610, 530),   # starting size of the GUI\r\n    required_cols=1,           # number of columns in the \"Required\" section\r\n    optional_cols=2,           # number of columbs in the \"Optional\" section\r\n    dump_build_config=False)   # Dump the JSON Gooey uses to configure itself\r\n\r\n...\r\n\r\ndef main():\r\n  parser = ArgumentParser(...)\r\n  # rest of code\r\n```\r\n\r\nwhere `get_parser_class` is much simpler than current `@Gooey`: it creates a subclass in closure with `.parse_args()` overridden.\r\n\r\n---\r\n\r\nOne place, where the decorator syntax could bite, is when writing unit tests for the command line parser (I do it a lot, as it used to have bugs, and I am [not the only](http://stackoverflow.com/questions/18160078/how-do-you-write-tests-for-the-argparse-portion-of-a-python-module) [one](http://programmers.stackexchange.com/questions/220081/how-should-i-go-about-bringing-this-code-under-test)).\r\n\r\nIn this code:\r\n\r\n```python\r\nimport gooey\r\nArgumentParser = gooey.get_parser_class(...)\r\n\r\ndef do_main(args):\r\n    ...\r\n    \r\ndef get_parser(parser_class=ArgumentParser):\r\n    parser = parser_class(...)\r\n    ...\r\n    return parser\r\n\r\ndef main():\r\n    args = get_parser().parse_args()\r\n    do_main(args)\r\n```\r\n\r\nthe parser can be tested separately by calling `get_parser(parser_class=argparse.ArgumentParser)` in test code.  (`main` can be made testable similarly, `do_main()` is already testable)\r\n\r\nWhere would you put `@Gooey`?"}}