Automatic Argparse UI #228
chapmanjacobd
started this conversation in
Ideas
Replies: 1 comment
-
You can wraparound argparse.parse_args(sys.argv[1:]) when y you need to run you GUI before argparse handle the error of required args |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It might be cool to create a class which would translate the parser or an object of parsed args into an automatic UI using the automatic Grid layout or something with a "Run" button at the lower right.
The scenario is that instead of passing a bunch of CLI arguments and flags one would be able to run the program without flags or arguments and they would be greeted with an interactive UI where they can see all the options and point, click, and type to set all the required and optional fields of a CLI tool.
maybe that user interface would look something like this:
https://github.com/python/cpython/blob/3.10/Lib/test/test_argparse.py
It would probably be easier to pass in parsed args instead of the parser but a more complete solution would probably need to read the parser because some arguments might be
required=True
which would cause the program to halt before getting to thetextual
code.Maybe there could be a compromise solution using
default=argparse.SUPPRESS
or requiring people to usenargs="?"
in all their positional arguments.Beta Was this translation helpful? Give feedback.
All reactions