wxPython Or Tkinter Advise PLEASEEEEEEEEE

Christopher Barker ChrisHBarker at home.net
Tue Aug 14 06:48:46 CEST 2001


Robert Amesz wrote:

> > + has a nice Canvas widget
> 
> From what I've read, a Canvas is just something you can draw on. You
> can do that easily on a wxWindow by making a handler for paint-events:
> blitting images, writing text, drawing, you can do it all in such a
> handler. However, don't expect C++ speed from a Python paint-handler.

The tk Canvas is much more than a place to draw things. WX does have
fine facilities for drawing to0 a panel or scrolled window, but it is
kind of slow if you have a lot of objects to draw(100s works OK 1000s is
pretty darn pokey).

Aside from speed, there is no easy way to draw something in wx and link
events to clicking on the object you draw. You would have to do all the
hit-test code yourself. Draggin around bitmaps is a little harder as
well, but it can be done, and Robin has a nice demo of it in the
wxPython demo.
 
There is work being done on a wxCanvas, but it has not yet been wrapped
for Python, and I'm not sure it's ready to be. If it does make it   to
prime time, it looks pretty nice, and is a zoomable and scrollable
vector drawing surface: try that, TK!

All in all, I like wx a lot, although the wrappes around the C++ are a
bit thin. This is good because you can easily ttranslate the C++ docs
into Python, but the code ends up being a bit verbose, and not terribly
Pythonic. this really is a minor quibble, however.

-Chris


-- 

Christopher Barker,
Ph.D.                                                           
cbarker at jps.net                      ---           ---           ---
http://www.jps.net/cbarker          -----@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Water Resources Engineering       ------   @    ------   @   ------   @
Coastal and Fluvial Hydrodynamics -------      ---------     --------    
------------------------------------------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list