Saturday, 13 February 2010

Tk and Tkinter

There is really good online documentation and superb tutorials on Tk (including Tkinter) at TkDocs. In fact, this site had me re-evaluate my decision not to learn/use Tkinter for anything.

Unfortunately, about three seconds with IDLE was enough to change my mind back. In particular, Tk’s use of menu bars and menus doesn’t fit with Win/GTK/Qt/OS X standards at all.

python3 basics

I discovered a couple of gotchas in getting python3 up and running in Ubuntu 9.10 (and probably Lenny and Squeeze as well).

Install python3.

Install python3-tk. (This one is easy to miss.)

Add to source files:

#!/usr/bin/python3

To invoke, at the command line do

$ python3 foobar.py

Geany’s F5 doesn’t work because it makes compile and execute calls using python rather than python3. I am loathe to change it at this point because it may wreak havok on python2.6 stuff.

As potential alternatives there are idle-python3.0 and idle-python3.1 packages, which I will be evaluating todayish.