Tkinter Unix and Windows incompatibility
akineko at gmail.com
Wed Aug 27 06:50:30 CEST 2008
I'm trying to create custom Tkinter/Pmw widgets for my project.
After testing my widgets under Unix (Solaris), I have tried them under
Windows and I got a surprise.
The widgets came out differently.
The following simple code snippet demonstrates the difference:
root = Tk()
w = Canvas(root, width=12, height=12, bd=4, relief=RAISED,
w2 = Canvas(root, width=12, height=12, bd=0, relief=RAISED,
w3 = Canvas(root, width=32, height=32, bd=4, relief=RAISED,
I noticed the difference because rectangle (or oval) object on the
canvas covers the entire canvas such that small differences in size
are very noticeable.
As Tkinter is a thin wrapper layer for Tk, I'm suspecting the
differences are rooted in Tk.
I'm using TK8.5 under Unix while Python under Windows uses TK8.4.
As I don't have any access to Python under Windows with TK8.5, I
cannot verify if this problem is fixed under TK8.5 for Windows.
So, here are my questions:
(1) Can anybody who has access to Python under Windows with TK8.5 to
verify if the problem is fixed.
If the problem is fixed, rectangle and ovals are inscribed to the
canvas boundary nicely.
If not, you see the rectangle is off by one pixel and the radius is
one pixel larger, I think. The boundary width is also not correct
(right side is one pixel wider).
(2) As the official distribution of Python under Windows uses TK8.4,
what is the best approach to make my widgets to work correctly under
- I could use sys.platform to code differently so that they look the
- I'm afraid this creates a problem when TK8.5 is finally introduced
to Python under Windows.
More information about the Python-list