A Ter, 2004-03-02 �s 11:42, Andrew P. Lentvorski, Jr. escreveu:
> On Fri, 27 Feb 2004, Christian Robottom Reis wrote:
>
> >
> > Was added describing the basic usage pattern to follow when using a
> > DrawingArea based on gjc and jdhunter's replies to the list. If anyone
> > would like to review it, I'd appreciate the effort.
> >
> > http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq18.008.htp
>
> An additional explanation of what self.set_double_buffered() does is
> probably called for. Having an application pause a long time with a blank
> DrawingArea and then suddenly having all the drawing miraculously appear
> can be hard to track down.
That is a sign of bad design. This only happens if you do this:
def expose_event_cb(widget, event):
# .... start some drawing
while more_work:
# do some heavy work to obtain results
# draw some more stuff based on results
# end drawing and return
But this kind of algorithm is completely incorrect in pygtk.
>
> Most GtkDrawingArea folks with complex drawing needs probably want
> set_double_buffered(False).
I disagree. "Having an application pause a long time with a blank
DrawingArea and then suddenly having all the drawing miraculously
appear" => that is exactly the purpose of double buffering. The user
should _not_ see the application redrawing. But there are cases when
disabling double buffering is justified. Let's consider two scenarios:
1. The drawing performed by the application is non-trivial, consisting
on gdk.Window.draw_* and font rendering operations:
-> in this case, double buffering should be kept activated, so that
all drawing is redirected by gtk to a temporary offscreen pixmap, and
the user sees an atomic change from the initial drawing state to the
final one.
2. The drawing performed by the application is already more or less
atomic. For example, rendering a pixbuf to a window:
-> in this case, double buffering is redundant, and only represents an
unnecessary overhead, so we might as well disable it.
Regards.
--
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/