Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Books on the Finer Points of Tkinter
5 points by orbisvicis on Sept 11, 2024 | hide | past | favorite | 5 comments
Over the past month I've had to write a bunch of GUI apps in tkinter and it was a lot of fun. Everything clicked, and I never felt like I was fighting the toolkit. Now I'd like to learn the finer points of the toolkit. Which rules do each layout (pack, place, grid) use, how events are propagated throughout widget tree, how bind tags actually work, and the difference between fill vs expand. Not a single tkinter book that I've seen covers the more advanced topics. I've found stack overflow to be a better resource, but not very holistic. I'm looking for a book that will reduce the amount of experimentation I'm going to have to do.

Contrast with gtk in C and Python which I used to do many years ago. I never found it fun like tkinter but the docs were pretty good. Great high level conceptual overview, not so great on widget details, and very little on design practices. Contrast with tkinter in which there are millions of ways for encapsulating widgets into classes.

As for QT, I've bounced off that every time I've tried to pick it up.

My point is, I really like tkinter and want to commit to it, with some help.



tkinter is a Python wrapper around Tk:

I would recommend learning Tk and the details of how tkinter wraps Tk https://en.wikipedia.org/wiki/Tk_(software)

These resources might help:

https://www.tcl.tk/

https://tkdocs.com/

https://tkdocs.com/book.html


Yeah but Tcl... is it worth it?

Also the tkdocs book is one of the books I reviewed, 3rd edition. The only mention of bindtags is a reference to the tkdocs website, which only documents the four default tags but not much else, which in turn references the Tk manual, which is hard to read as I don't understand Tcl.


I don't understand Tcl

Yet.


As you stated above: "I really like tkinter and want to commit to it".

>> Yeah but Tcl... is it worth it?

That is for you to decide.


As others have pointed out, tkinter is just a wrapper around Tk, so the best way to learn more about it is to learn about Tk. The documentation for Tk [1] is fairly comprehensive: for example, the algorithm used by the `pack` command that you asked about is explained here: [2].

It's definitely worth learning at least some very basic Tcl if you want to get as much as possible out of tkinter - sometimes you end up having to use `widget.tk.eval()` to use a Tk feature that tkinter doesn't provide a good wrapper for.

[1] https://www.tcl.tk/man/tcl/TkCmd/contents.html [2] https://www.tcl.tk/man/tcl/TkCmd/pack.htm#M27




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: