[Python-Dev] Event loops, PyOS_InputHook, and Tkinter

Fredrik Lundh fredrik at pythonware.com
Mon Nov 14 17:30:34 CET 2005


Michiel Jan Laurens de Hoon wrote:

> This is exactly the problem. Drawing one picture may consist of many
> Python commands to draw the individual elements (for example, several
> graphs overlaying each other). We don't know where in the window each
> element will end up until we have the list of elements complete. For
> example, the axis may change (see my example to Martin). Or, if we're
> drawing a 3D picture, then one element may obscure another.
>
> Now, if we have our plotting extension module in a separate thread, the
> window will be repainted each time a new element is added. Imagine a
> picture of 1000 elements: we'd have to draw 1+2+...+1000 times.
>
> So this is tricky: we want repainting to start as soon as possible, but
> not sooner. Being able to hook into Python's event loop allows us to do so.

the solution to your problem is called damage/repair, is not tricky at
all, and is supported by every GUI toolkit under the sun.

(if you don't know how it works, google for "widget damage repair")

</F>





More information about the Python-Dev mailing list