wxPython worries

Eric Brunel eric.brunel at N0SP4M.com
Fri Jan 16 04:21:48 EST 2004


MetalOne wrote:
[snip]
> Tkinter has issues here
> also.  There is no means for a worker thread to put an event in the
> GUI thread.

We've successively used the event_generate method on Tkinter widgets from worker 
threads to communicate with the main thread. You can also have less 
straightforward solutions involving the main thread regularly checking for a 
Queue or Event (using the after method) to get events from the worker threads. 
So you definitely can't say there's "no means" to do it. But it's clearly not as 
easy as it should.

[snip]
> Tkinter is also giving me problems.  I have been trying to add
> controls to a canvas and to have a scrollbar that will scroll the
> controls on the canvas.  I think I have it figured out now, but it is
> damn near impossible to figure out from the documentation.  I had to
> scour the internet looking for solutions.

The documentation is clearly the main problem with Tkinter. It's not really that 
there's not enough, but useful information must be gathered from too many places...

The best places are:
- For beginners, "Thinking in Tkinter" from Stephen Ferg: 
http://www.ferg.org/thinking_in_tkinter/index.html
- Tkinter demos in the Python distribution: unfortunately one of Tkinter's best 
kept secrets. Just go to <Python root>/Demo/tkinter and look at the scripts. 
I've learnt a lot from them, even if they're far from perfect (where on earth 
did they get the idea to make all their application inherit from Frame?!)
- "An introduction to Tkinter" from Fredrik Lundh: 
http://www.pythonware.com/library/tkinter/introduction/index.htm - very useful, 
but unfortunately incomplete...
- And finally the man pages for tcl/tk: http://www.tcl.tk/man/ - only useful 
once you've practiced a bit, since you must know how to translate tcl/tk to 
Python/Tkinter to be able to use it.

The book "Python and Tkinter programming" from John Grayson seems interesting, 
but I never used it myself. You can get an idea of its contents and download the 
example scripts here: http://www.manning.com/grayson/

HTH
-- 
- Eric Brunel <eric dot brunel at pragmadev dot com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com




More information about the Python-list mailing list