Tkinter docs?

aapost aapost at idontexist.club
Wed May 24 00:00:56 EDT 2023


On 5/23/23 21:18, Rob Cliffe wrote:

> Comments, anyone?
> Better yet (holds breath ...) can anyone point me towards some decent 
> tkinter documentation?

The variables are slightly more integrated when using tcl/tk directly, 
python has to have the object so you can track/use them easier. And the 
variables are more of what is intended to track a widgets purpose, vs 
state stuff that is more the state of the displaying of the widget.

occasionally giving tcl/tk a try directly helps, and using the official 
tcl/tk docs in addition to a couple other decent docs below.

https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/index.html
https://tkdocs.com/tutorial/styles.html

https://www.tcl.tk/man/tcl8.6/
https://www.tcl.tk/man/tcl8.6/TkCmd/contents.html
https://www.tcl.tk/man/tcl8.6/TkLib/contents.html

(this used to be some documentation that I only discovered existed 
recently, but most of it doesn't load and I don't know that anyone 
backed it up for rehosting..)
https://web.archive.org/web/20200227170827/http://effbot.org/tkinterbook

tk is decent for what it can do, (and it could do potentially more if 
you had a lifetime to dedicate to it, lol) and it's reasonably stable 
and not being perpetually hacked about and broken like gtk.

A couple additional pointers in case these haven't been figured out yet:
Running it interactively and using tab complete helps.
If you are running an app you can comment out the mytk.mainloop() 
statement then run python -i yourtk.py to give you access to all widgets 
live.
For navigating them, just come up with a widget naming convention that 
works for you in a similar vein to how tk does (like .frame.frame.label 
to start),
i.e.
main = tk.Tk()
main.frame = tk.Frame()
That way if you have anchored your widgets to something at the root 
level you can navigate down to whatever you are looking for easily. (you 
can also use winfo_children() iteratively to travel the way tcl 
structures them, but that is tedious).


More information about the Python-list mailing list