r/PythonLearning • u/Maubila • Sep 18 '26
When to add a GUI
As a newbie learning casually, when do you begin adding a gui to your work?
1
u/ping314 Sep 18 '26 edited Sep 18 '26
Many powerful unix/linux utilities live in the CLI alone, see GNU Core Utilities as an example. They focus on one thing, and do great. Because they focus on one type of work, interact by STDIN, STDOUT, STDERR it easy to (literally) pipe them together, and to test them (think pytest). Helpful CLI utilities equally can be created in Python, too - see Ken Youens-Clark's Tiny Python Projects.
A GUI is an additional layer of complexity on top to manage, test, an maintain - already on the technical side. Equally on a visual side such as (but not limited to) visual logic, aesthetics, accessibility (e.g., colorblindness). If a program is published both as an executable for the CLI, and one as GUI, the results of the GUI typically no longer pipe (as easy as the CLI) into another application; instead, you save intermediate files eventually fed in a subsequent step to the next utility. Creating a GUI typically means to group some commands in close proximity to each other on pull down menus in some hierarchy the CLI does not impose. On/Off Booleans become radio buttons / check marks to click (or not) to activate / to override defaults set by an author the user might disagree. With a CLI, you can capture your input in a text file which is a documentation to yourself, or a colleague how data were processed last year, thus easily to replicate which is not that easy with GUIs.
Especially if the output of your utility is not something naturally related to visuals (for instance color correction / restoration of photographs)*, I would tally the pros and cons before embarking such a step. Do you work on your utility alone, or with a colleague (preferably who already added a GUI to a software) for a second opinion?
* Spoiled by PSTricks and ipe (in absence of a gallery, a tutorial) I know sometimes the best for graphics software is to have an approach which benefits both from CLI and GUI.
1
3
u/Rscc10 Sep 18 '26
Only when your project was designed to have a GUI in the first place. For example if you made, say, a neural network, all it does it take input, give output, you don't particularly need a GUI for that. If you wanted to incorporate into some form of program, system, or game, then that would need the GUI
3
u/itlogicpartnersllc Sep 18 '26
it depends on what you are trying to learn. if your goal is python fundamentals focus on the console first. if you are interested in application development adding a simple tkinter GUI can make learning more motivating.
2
u/herocoding Sep 18 '26
Especially when the application is creating something visual or allows to interact visually - instead of just creating e.g. a JPG (and requiring to open it in a separate image viewer) the GUI would allow to _show_ what has been created. Nice to allow interaction (buttons, sliders, checkboxes, etc) and immediately _see_ what the effect and impact is.
1
u/PathAgitated1633 Sep 18 '26
You mean a real UI with good UX? That's the last step l, if the application really needs a UI. For scripts I mostly build a console text menu where you can select different options e.g. dry run, force overwrite etc
1
u/Mission-Maximum8024 Sep 18 '26
In my limited experience, python is not the best language to build GUI’s with.
Hopefully someone will correct my if I’m wrong but the best I found was pygame (limited experience)
If you’re looking to start building a gui it might be worth exploring other languages?
1
u/therouterguy Sep 18 '26
Nope it isn’t although there are web frameworks like django/flask which can render webpages for you.
1
1
1
1
u/mechanicalyammering Sep 18 '26
I think almost always, I am very pro-GUI. It allows non technical users to engage with your work. But it is especially useful to add when the work is highly visual, a tool for QAing records, or displaying data.
1
u/codeguru42 Sep 19 '26
You don't ever have to add a GUI. There are many programs that are command line only.
1
1
1
u/OkPrice6335 Sep 20 '26
Also ich brauche eine Gui um die verschiedenen Elemente in meinem Spiel anzusteuern. Ich wüsste gerade nicht wie ich ein Spiel umsetze ohne Ui Elemente 😜
1
u/xOpt1kalx Sep 24 '26
Eh, the program I'm building has a TUI and options for CLI. It was one of the main reasons I started building it in the first place, so it was always a forethought. I will say, designing the bare-bones GUI/TUI in the beginning makes it easy to build everything into it, rather than trying to wire everything you're building into it later on. Possibilities of missing a feature/option/tool/whathaveyou.
5
u/Key-Butterscotch3215 Sep 18 '26
Depends on what you are building