The question might have an obvious answer. I believe it is not possible but I am not able to test it myself on the Rpi zero W until next week. I assume Tkinter requires a “window manager” from an OS that has a desktop environment. Is there a workaround to starting a Tkinter program directly from the terminal, other than installing the raspios desktop environment? I am trying to keep the system as light as possible and preferably auto start the program on boot. Thanks in advance for any advice!
I assume Tkinter requires a “window manager” from an OS that has a desktop environment.
To clarify a few terms that have a specific technical meaning in GNU/Linux based operating systems:
Window(ing) system: Software that provides the basis of a desktop GUI, which is mostly about relationships with the kernel and hardware. The predominant windowing system in GNU/Linux (including Raspbian/RpiOS) is X. It also, as the name implies, provides a simple interface to draw on a 2D surface including rectangular windows in which an application can run, and a HID interface (human input device, eg. mice and keyboards). The "2D surface" can include multiple desktops, screens, etc.
Running a TkInter does require this, but it is probably not what you think it is. If you run bare X without a window manager, you get a black screen with a small white "X" shaped mouse pointer. There is then no way to do anything other than move the X around. However, you can script it to run applications when it starts, including a window manager (and/or your TkInter app)...
Window manager: Software that provides a fancier interface by adding things like window borders, titlebars, etc. Sometimes these also provide menus and taskbars and can be run alone, although normally they are integrated into a desktop environment. Examples of window managers (abbreviated WM) are fvwm2, fluxbox, kwin, and openbox (which I am pretty sure is the default used with Raspbian).
Desktop Environment: Software that provides hefty top level things such as a file browser, taskbars and menus, app widgets, etc. On Raspbian this is an LXDE (their names often end in DE) spin-off that used to be called PIXEL but now seems not to have any name.
You don't need the last two, although a WM might end up being useful. You can start X running a single application full screen, which I think is what you want. If you auto-login this at boot it's called a kiosk and you'll find lots of discussion on that here and elsewhere.
The basic technique to running a single application is to put it in an
.xinit file. You can then start the GUI from a console with the
startx command. If you look around for information about these (
xinit) you will find enough of it.
You do not need to use the Raspbian/RpiOS desktop version to do this. You can start with the lite version and install X.