Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required arguments shown as optional #447

Closed
ATran31 opened this issue Jun 6, 2019 · 3 comments
Closed

Required arguments shown as optional #447

ATran31 opened this issue Jun 6, 2019 · 3 comments

Comments

@ATran31
Copy link

ATran31 commented Jun 6, 2019

I see you fixed this years ago in #78 but for some reason I am having this problem still. I'm using Gooey 1.0.2 on Python 3.6.8, Windows 7. I initially installed from pip and then tried to correct the issue by cloning the repo. Same result both cases.
My argument definitions:

image

Capture1

@elad-eyal
Copy link
Contributor

Here is code to reproduce:

from gooey import Gooey, GooeyParser
@Gooey
def main():
    p=GooeyParser()
    p.add_argument('-s',required=True, widget='FileChooser')
    p.add_argument('-l',widget='DirChooser')
    p.parse_args()
if __name__=='__main__':
    main()

It still exists on 1.0.3-release as well.

However, note that the arguments are not treated as optional; it's only the title "optional argument" which bothers you.

As a workaround, you can create a single argument_group (optionally name it.)

like this:

from gooey import Gooey, GooeyParser
@Gooey
def main():
    p=GooeyParser()
    g=p.add_argument_group()
    g.add_argument('-s',required=True, widget='FileChooser')
    g.add_argument('-l',widget='DirChooser')
    p.parse_args()
if __name__=='__main__':
    main()

@ATran31
Copy link
Author

ATran31 commented Jun 7, 2019

Thanks. I have created required and optional group as a workaround.

@chriskiehl
Copy link
Owner

chriskiehl commented Jun 14, 2019

Yeah, this comes up a lot. I need to add a FAQ and update the README. short answer: this is by design. Longer answer on this issue: #368

Summary version: The original required/optional split in Gooey was a bad choice and doesn't make sense now that there are first class argument groups. Meaning, there isn't necessarily a top level 'required' group into which you can reliably put everything marked as required while still honoring argument groups. They're exclusive ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants