Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GUI for Argparse

I'm using a simple argparse function to in my python script :

def get_args():
    """Get CLI arguments and options"""
    parser = argparse.ArgumentParser(description='AngioTool File Analyzer',
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument('rootPath',
                        help="path to files for the experiment",
                        action=FullPaths, type=is_dir)

    parser.add_argument('-c', help='string to specify the control device to which all devices should be ratioed', default='D1')
    parser.add_argument('-p', help="list of fields to plot",
                        default=['Total Vessels Length', 'Total Number of End Points', 'Total Number of Junctions'])
    parser.add_argument('-i', help='string to specify first interval', default='min')
    parser.add_argument('-t', help='comma serperated list with chart titles to be placed on charts', default="Chart 1, Chart 2, Chart 3")
    parser.add_argument('-V', action='version', version='%(prog)s 1.0', help='print version number')

    results = parser.parse_args()

    return results

My goal is to wrap up my code and distribute the program to a few people using py2exe and py2app. I've run across a few modules which, in theory, make it easy to generate a UI from the argparse code rather then having to make the users interact with the command line. Unfortunately, the tools I've found (argparseui, gooey) require tools that are a bit of a pain to deal with (e.g. pyQT4 and wxPython) and don't support Python3.

Are there any other modules to achieve this a simple UI from argparse with more mainstream dependencies?

like image 533
agf1997 Avatar asked Jan 17 '26 23:01

agf1997


2 Answers

There is also Gooey! I've yet to use it I've used it once, and it's pretty amazing; it even has File Selector widget.

File Selector Animated Gif Example

Disclaimer: I've taken this from an answer in a similar question

like image 147
tutuDajuju Avatar answered Jan 19 '26 11:01

tutuDajuju


Since you don't want to depend on any third party libs like pyqt then you should consider some tools using tk like this https://github.com/codypiersall/cligui

like image 29
Achayan Avatar answered Jan 19 '26 13:01

Achayan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!