Tkinter or wxpython?

Kevin Walzer kw at codebykevin.com
Wed Aug 8 14:22:32 EDT 2007


Chris Mellon wrote:

>> What do you mean here? Things like keyboard accelerators, menu
>> placement, and so on? Those things are already natively implemented by
>> Tk, and the developer just needs to invoke them. Sometimes some
>> conditional code is required for stuff like keyboard accelerators (the
>> "tk windowingsytem" command is useful for this), but again, it should
>> Just Work.
>>
>> Or am I missing something?
>>
> 
> There's conventions for shortcuts and they vary by platform. For
> example, home/end do different things on a mac vs on windows.
> Scrollbars interact differently, and menu pulldowns operate
> differently. To my knowledge, while Tile can replicate the *look* of
> these things, it does not help with the interaction.

On Windows and Mac, Tk gets the menus correct by default (menu is at the 
top of the screen on the Mac, attached to a window on Windows). The Tk 
scrollbar is native on the Mac; the Tile  scrollbar has problems. On 
Windows, the Tile scrollbar maps to Vista or XP or Win32, depending on 
Windows version. You need to correctly specify the command-accelerator 
in your code (on Windows it's the Control key, on the Mac it's Command), 
but assuming you do this, it works fine. I don't use "home" and "end" 
keys myself (I think these are more common on Windows than Mac) so I 
can't speak to that. Under Tk, keyboard navigation with the tab key 
generally works as expected on the Mac, and I assume so for Windows as 
well.

The biggest drawback with Tk/Tile on the Mac is that even with Tile 
theming, it's still a bit outdated--Tile hooks into some older API's on 
the Mac that are more compatible with Tk; for instance, the notebook 
tabs look like Jaguar-era tabs (c. 2002). The Tile scrollbar is broken, 
but the Tk one works natively.

Tile on Windows looks pretty darn good--I've played with the Windows 
Inspection Tool Kit, a well-designed Tcl/Tk application on Windows XP 
that uses Tile, and it's indistinguishable from something developed in 
VB or Delphi. (See http://magicsplat.com/wits/screenshot.html). Tile on 
the Mac requires a bit more hackery, but it's quite possible to get 
something looking nearly native (see 
http://www.codebykevin.com/portauthority.html).

As for X, Tk and Tile are more of a mixed bag, because there is simply 
no single standard to target. Standard Tk looks and feels like Motif, as 
you know. Some of the Tile themes under X don't look much better. The 
most popular Tile theme on X is probably Clam, which looks more like a 
modern Gtk Clearlooks-style theme (see 
http://tktable.sourceforge.net/tile/screenshots/demo-clam-unix.png or 
http://www.codebykevin.com/pylocate-tile-x11.png). As far as I know, 
Tk/Tile offers reasonable defaults for X, unless you are looking for 
specfic integration with a particular environment (i.e. Gnome or KDE); 
in that case it's not as acceptable.

> 
> Don't think I'm singling out Tk, Gtk has exactly the same problem -
> you can make the buttons look native, but it doesn't adjust the
> behavior.

Tk does a better job with platform-specific defaults and behaviors than 
Gtk. When I read complaints about Tk on Windows, it's more on how ugly 
Tk is, not that its menus/keyboard behaviors don't work correctly.

-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com



More information about the Python-list mailing list