Package: cli2gui
Cli2GuiUse this module to convert a CLI program to a GUIComparison to similar projectsParser SupportGUI Toolkit SupportGUI Feature SupportRoadmapUsing Cli2Gui in your projectDecoratorFunctionrun_function (optional)auto_enable (optional)parser (optional)gui (optional)theme (optional)darkTheme (optional)sizes (optional)image (optional)program_name (optional)program_description (optional)max_args_shown (optional)menu (optional)Click2Guirun_function (required)parser (not applicable)Data StructuresDocumentationInstall With PIPLanguage informationBuilt forInstall Python on WindowsChocolateyWindows - Python.orgInstall Python on LinuxAptDnfInstall Python on MacOSHomebrewMacOS - Python.orgHow to runWindowsLinux/ MacOSBuildingDownload ProjectCloneUsing The Command LineUsing GitHub DesktopDownload Zip FileScreenshotsDesktopThemesCommunity FilesLicenceChangelogCode of ConductContributingSecuritySupportRationaleComparison to similar projectsDo let me know if any of these are incorrect. Some of the comparisons are
based off documentation/ the readmeParser SupportParserCli2GuiGooeyQuickArgparse✔✔❌Optparse✔❌❌DocOpt✔❌❌Click✔                 *❌✔GetOpt✔❌❌Dephell Argparse✔❌❌* Partial support (use [Click2Gui](#click2gui))

This works for simpler programs but sadly falls flat for more complex programsGUI Toolkit SupportGUI ToolkitsCli2GuiGooeyQuickTkinter✔❌❌WxWidgets❌✔❌Qt✔❌✔Gtk❌❌❌Web✔❌❌GUI Feature SupportBasic GUICli2GuiGooeyQuickOverride name/ description✔✔❌Theming✔⚠        Limited⚠        LimitedDarkMode✔❌✔Window Size✔✔❌Element Size✔❌❌Custom Images✔✔❌Cli2Gui is pretty lacking in these features and will probably remain that way
to ease maintainability - the primary aim is to support multiple argparse
libraries over fancy widgetsAdvanced GUICli2GuiGooeyQuickDropdown✔✔✔Slider❌✔✔Tabs❌✔✔Menus✔✔❌Max Args before Scroll✔❌❌RoadmapFor completed components, see the changelog (link below)FeatureDescriptionStatusPython Firehttps://github.com/google/python-fireUnder considerationUsing Cli2Gui in your projectfromcli2guiimportCli2GuiDecorator@Cli2Gui(run_function,auto_enable=False,parser="argparse",gui="pysimplegui",theme="",darkTheme="",sizes="",image="",program_name="",program_description="",max_args_shown=5,**kwargs)FunctionCli2Guiis a function factory.
It takes keywords arguments likerun_functionandauto_enable,
and returns a decorator function.The decorator function takes a function likemainand returns a new function:# main.pydefrun(args):print(args.arg)# The main function can be used as a CLI entrypoint# Example: python -m mymodule:main.maindefmain():parser=argparse.ArgumentParser(description="this is an example parser")parser.add_argument("arg",type=str,help="positional arg")args=parser.parse_args()run(args)decorator_function=Cli2Gui(run_function=run,auto_enable=True,)# The gui function can be used as a GUI entrypoint# Example: python -m mymodule:main.guigui=decorator_function(main)if__name__=="__main__":# When main.py is called as script, run the GUI version# Example: python main.py# Example: ./main.pygui()run_function (optional)The function to call when the user clicksStart. Defaults to None. If not
specified, program continues as normal (can only run once)defrun(args):print(args.arg)@Cli2Gui(run_function=run)defmain():# Typically, the main function has no arguments,# but parses arguments from sys.argv,# which happens in parser.parse_args()parser=argparse.ArgumentParser(description="this is an example parser")parser.add_argument("arg",type=str,help="positional arg")args=parser.parse_args()run(args)auto_enable (optional)Enable the GUI by default. Defailt is False.To enable GUI, add--cli2gui.
To disable GUI, add--disable-cli2gui.@Cli2Gui(auto_enable=False)parser (optional)Override the parser to use, defaults to argparse. Current options are:
"argparse", "getopt", "optparse", "docopt", "dephell_argparse"@Cli2Gui(parser="argparse")gui (optional)Override the gui to use. Current options are:
"pysimplegui", "pysimpleguiqt","pysimpleguiweb". Defaults to "pysimplegui".pysimplegui is the recommended option@Cli2Gui(gui="pysimplegui")theme (optional)Set a base24 theme. Can also pass a base24 scheme file. eg.one-light.yaml@Cli2Gui(theme=["#e7e7e9","#dfdfe1","#cacace","#a0a1a7","#696c77","#383a42","#202227","#090a0b","#ca1243","#c18401","#febb2a","#50a14f","#0184bc","#4078f2","#a626a4","#986801","#f0f0f1","#fafafa","#ec2258","#f4a701","#6db76c","#01a7ef","#709af5","#d02fcd"])darkTheme (optional)Set a base24 dark theme variant. Can also pass a base24 scheme file. eg.one-dark.yaml@Cli2Gui(darkTheme=["#282c34","#3f4451","#4f5666","#545862","#9196a1","#abb2bf","#e6e6e6","#ffffff","#e06c75","#d19a66","#e5c07b","#98c379","#56b6c2","#61afef","#c678dd","#be5046","#21252b","#181a1f","#ff7b86","#efb074","#b1e18b","#63d4e0","#67cdff","#e48bff"])sizes (optional)Set the UI sizes such as the button size@Cli2Gui(sizes={"title_size":28,"label_size":(30,None),"input_size":(30,1),"button":(10,1),"padding":(5,10),"helpText_size":14,"text_size":11})image (optional)Set the program icon. File extensions can be any that PIL supports@Cli2Gui(image="path/to/image.png")program_name (optional)Override the program name@Cli2Gui(program_name="custom name")program_description (optional)Override the program description@Cli2Gui(program_description="this is a custom description")max_args_shown (optional)Maximum number of args shown before using a scrollbar@Cli2Gui(max_args_shown=5)menu (optional)Add a menu to the program. Defaults to None. eg.THIS_DIR=str(Path(__file__).resolve().parent)menu={"File":THIS_DIR+"/file.md"}Works significantly better with pysimplegui than pysimpleguiqt@Cli2Gui(menu={"File":THIS_DIR+"/file.md","Another File":THIS_DIR+"/another_file.md",})Click2GuidefClick2Gui(run_function,gui="pysimplegui",theme="",darkTheme="",sizes="",image="",program_name="",program_description="",max_args_shown=5,menu="",**kwargs):Very similar to the decorator but with the following differences...run_function (required)Specify the click function to use. (attempts were made to offer full program
support however this behaved very poorly)parser (not applicable)As this is exclusively for click, this option is not presentData StructuresSee theDATA_STRUCTURESfor more information.DocumentationA high-level overview of how the documentation is organized organized will help you know
where to look for certain things:TheTechnical Referencedocuments APIs and other aspects of the
machinery. This documentation describes how to use the classes and functions at a lower level
and assume that you have a good high-level understanding of the software.Install With PIPpipinstallcli2guiHead tohttps://pypi.org/project/cli2gui/for more infoLanguage informationBuilt forThis program has been written for Python versions 3.8 - 3.11 and has been tested with both 3.8 and
3.11Install Python on WindowsChocolateychocoinstallpythonWindows - Python.orgTo install Python, go tohttps://www.python.org/downloads/windows/and download the latest
version.Install Python on LinuxAptsudoaptinstallpython3.xDnfsudodnfinstallpython3.xInstall Python on MacOSHomebrewbrewinstallpython@3.xMacOS - Python.orgTo install Python, go tohttps://www.python.org/downloads/macos/and download the latest
version.How to runWindowsModulepy -3.x -m [module]or[module](if module installs a script)Filepy -3.x [file]or./[file]Linux/ MacOSModulepython3.x -m [module]or[module](if module installs a script)Filepython3.x [file]or./[file]BuildingThis project useshttps://github.com/FHPythonUtils/FHMaketo automate most of the building. This
command generates the documentation, updates the requirements.txt and builds the library artefactsNote the functionality provided by fhmake can be approximated by the followinghandsdown--cleanup-odocumentation/reference
poetryexport-frequirements.txt--outputrequirements.txt
poetryexport-frequirements.txt--withdev--outputrequirements_optional.txt
poetrybuildfhmake auditcan be run to perform additional checksDownload ProjectCloneUsing The Command LinePress the Clone or download button in the top rightCopy the URL (link)Open the command line and change directory to where you wish to
clone toType 'git clone' followed by URL in step 2gitclonehttps://github.com/FHPythonUtils/Cli2GuiMore information can be found athttps://help.github.com/en/articles/cloning-a-repositoryUsing GitHub DesktopPress the Clone or download button in the top rightClick open in desktopChoose the path for where you want and click CloneMore information can be found athttps://help.github.com/en/desktop/contributing-to-projects/cloning-a-repository-from-github-to-github-desktopDownload Zip FileDownload this GitHub repositoryExtract the zip archiveCopy/ move to the desired locationScreenshotsDesktopThemesLightDarkBlackCommunity FilesLicenceMIT License
Copyright (c) FredHappyface
(See theLICENSEfor more information.)ChangelogSee theChangelogfor more information.Code of ConductOnline communities include people from many backgrounds. TheProjectcontributors are committed to providing a friendly, safe and welcoming
environment for all. Please see theCode of Conductfor more information.ContributingContributions are welcome, please see theContributing Guidelinesfor more information.SecurityThank you for improving the security of the project, please see theSecurity Policyfor more information.SupportThank you for using this project, I hope it is of use to you. Please be aware that
those involved with the project often do so for fun along with other commitments
(such as work, family, etc). Please see theSupport Policyfor more information.RationaleThe rationale acts as a guide to various processes regarding projects such as
the versioning scheme and the programming styles used. Please see theRationalefor more information.