Tools to help with text mode (i.e. non-GUI) input
Grant Edwards
grant.b.edwards at gmail.com
Tue Jan 14 19:54:09 EST 2025
On 2025-01-14, Chris Green via Python-list <python-list at python.org> wrote:
> Yes, thanks all, maybe just straightforward curses is the way to go.
> Looking at some of the 'cleverer' ones they end up looking remarkably
> like GUI code, in which case I might as well use a GUI.
The source code to configure and handle a UI with a certain set of
input widgets is going to be pretty much the same regardless of the
low-level screen bashing details involved in rendering the widgets.
You choose a TUI toolkit like curses panel/menu/forms instead of a GUI
toolkit like gtk because you need your app to run on a terminal
instead of on a X11/wayland screen, not because you want your app to
be simpler than the code for a GUI app (as you've seen, it isn't).
> I have written a (fairly simple) Gtk based python program, I was
> just trying to avoid all the GUI overheads for a little new project.
If you want to avoid the [TG]UI overhead, then command line options
are your friend. If that's not sophisticated enough the gnu "readline"
library with a simple command processor is a common next step.
Or you can use curses to print some help stuff at the top of the
terminal window and then do everything based on single-stroke "command
keys" that print output in the lower part of the terminal window.
--
Grant
More information about the Python-list
mailing list