Tkinter canvas double buffering

Fredrik Lundh fredrik at pythonware.com
Mon Mar 12 16:50:15 EST 2001


jason petrone wrote:
> Is there an easy way to do double buffering with the canvas?  The only way
> I see is rasterizing it offscreen myself into a BitmapImage, then drawing that.
>
> I've done this plenty of times in Xlib and GTK, but I would prefer to use
> Tk for this.  Could someone post some example code?

the canvas is always double-buffered.  just create or modify
canvas items as usual.  when Tk returns to the event loop,
the canvas is redrawn as soon as possible.

to force redraw, use w.update_idletasks()

to get an unbuffered canvas, use the wck (tkinter.effbot.org)

Cheers /F

<!-- pythonworks 1.2 coming soon:
http://www.pythonware.com/products/works/index.htm
-->





More information about the Python-list mailing list