Still on python GUI toolkit

Kevin Altis altis at semi-retired.com
Wed Nov 21 23:30:41 CET 2001


"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:GDSK7.7557$Z_1.1235809 at newsc.telia.net...
> Tyler Eaves wrote:
> >
> > > The application I tested is a pixel-intensive type of application
because
> > > it is the most challenging of the tools I will need: it displays
> > > continuously an 80x80 syntetic image randomly generated with 256
> > > graytones, by using small filled squares for each pixel
> >
> > Unless you used Tkinter's canvas widget, this wasn't a fair test.
>
> if he *did* use the canvas widget, it wasn't a fair test.
>
> the Tkinter canvas is optimized for applications that create
> a model once, and then make relatively minor modifications
> to it (e.g. graphics editors).
>
> if you have data that changes rapidly, you'll likely to spend
> more time tranferring data between Python and the canvas
> model than you spend on updating the screen.
>
> better use a data display widget (try searching google for
> "custom Tk widgets"), or use something like Tkinter 3000's
> WCK:
>
> http://www.pythonware.com/products/tkinter/tkinter3000.htm
>
> as an example, here are timings for Gordon Williams' oscillo-
> scope benchmark (search the archives for source code; the
> Tkinter 3000 version is available in the WCK source kit):

The other thing I noticed last time I did some plotting and drawing with the
canvas widget was the huge amount of memory consumed and long redraw times
when you had lots of points or lines. It appears it is maintaining lists of
all the drawing operations and then playing those back for a window redraw
rather than using an offscreen buffer. My mistake was using it to draw
millions of points :) Around that time I also decided I wanted native
widgets so I switched to wxPython for apps, but it is nice to know there is
a tkinter canvas widget that is more appropriate for plotting for those that
want to use tkinter.

ka





More information about the Python-list mailing list