Cross-platform GUI app -- Tkinter?

Russell E. Owen owen at astrono.junkwashington.emu
Fri Jul 13 12:14:23 EDT 2001


In article <3b4e211f$1 at news.blarg.net>,
 steveha at animal.blarg.net (Steve R. Hastings) wrote:

>Hello.  I am new to Python, studying books to come up to speed.
>
>I have one question I have not really seen discussed in FAQs and such:
>
>If I want to make a GUI application with menus and such, and I want it to
>be easily portable to multiple platforms, what is the best way to do it?
>At this point I suspect Tkinter is the way to go.

How cross-platform?

If you mean Mac, Windows and unix then Tkinter or Jython (Python running 
on Java) are your only options in Python. I have not used Jython, but am 
about to try it, because Tkinter has some serious limitations and some 
nasty problems on the Mac (including: file events don't work -- a known 
problem -- and custom menus cause crashes, at least on my machines). I 
would start with Jython -- or pick another language.

If you only mean various flavors of Windows and unix, then there are 
additional packages to choose from, including wxPython.

If you have additional platforms in mind, I'm afraid I can't offer any 
advice.

As to learning Tkinter...
An Introduction to Tkinter, by Fredrik Lundh, is excellent but 
incomplete (I'm not sure if it's a work in progress or that's as far as 
it's going to go; I hope the former). In any case, see links from 
PythonWare Library <http://www.pythonware.com/library/index.htm> for 
HTML and PDF versions.

John Grayson's book "Python and Tkinter Programming" is fine and well 
worth having. It's also the only book I know of on the subject.

You'll probably also want one ore more Tk references. I've been pleased 
with "Effective Tckl/Tk Programming" by Harrison and Mclennan. It 
doesn't try to cover everything, but has useful info about some subtler 
aspects of making real, usable GUIs with Tk.

Tkinter is an odd mix of strengths and weaknesses. The Canvas class, for 
line drawings and such, is quite powerful. On the other hand Tk has 
limitations that are bizarre in a toolkit as mature as this one, 
including:
- "copy and paste" of text don't "just work", and it's a real pain to 
implement them (I've still not finished the job for my app, but at least 
I've gotten some common cases working). I suspect this is a side effect 
of a toolkit originally written for unix.
- there is no good way to implement a text display that allows users to 
copy info but not change it. This is a famous FAQ and the usual solution 
is an ugly hack.

-- Russell



More information about the Python-list mailing list