[pygtk] Drawing in Drawing Area

Andrew P. Lentvorski bsder@mail.allcaps.org
Fri, 18 Oct 2002 22:13:58 -0700 (PDT)


On Fri, 18 Oct 2002, LDC - Pablo Endres Lozada wrote:

>
> 	I've tryed to draw in a Drawing Area but the only way
> 	that it works is suscribing the paint method to
> 	the expose-event.
>
> 	Is there anothere way to do this??
>
> 	Can I paint at any time or must it be via signals?

You should only paint in response to an expose signal.  Before the expose
signal, the window is not required to be realized.

Most applications generally handle drawing in a GtkDrawingArea by having
an offscreen pixmap which is the same size as the window to be painted.
The offscreen pixmap gets programmatically redrawn in response to a
configure event or user event.  Then, the pixmap gets blitted to screen in
response to an expose event (X generated or synthetically generated with
queue_draw()).

Hope this helps.
-a