Hi John, > I have a several classes, all derived from a single base class Artist, > which render into a gtk.gdk.Drawable with a call to 'draw'. Artist > instances can contain instances of Artist children. When an instance > receives a draw request (may come from interactive use or a timeout) > it draws into the drawable and then passes the request on to the > children it contains. > > The problem is that this introduces flicker as A draws it's > background, and then A's children draw over it. > > There is, however, one Artist instance that all the drawing requests > filter through, and what I would like to do is suppress the screen > redraw until all the children are through drawing. Sometime like > > screen_refresh_off() > self.draw(drawable) > for child in self.get_artists(): > child.draw(drawable) > screen_refresh_on()
You could do manual iteration of the Gtk mainloop to turn off the screen refresh. That might be one way to ensure that you only draw A's background after all of its children has finished rendering themselves. > Where drawable is a gtk.gdk.Window. What I am currently doing is > drawing to a pixmap > > self.draw(pixmap) > for child in self.get_artists(): > child.draw(pixmap) > drawable.draw_drawable(gc, pixmap, 0, 0, 0, 0, self.width, self.height) > > This works, and produces flicker free drawings, but I suffer a > performance hit. Since I believe pygtk2 already does double buffering > with drawing areas, I wonder if I am duplicating some effort that > might be saved with some magic tidbit of knowledge. You can turn off the double buffering of any widget by calling the set_double_buffered(...) method of a widget with gtk.FALSE argument. Since you're manually diverting the drawing actions to an offscreen gtk.gdk.Pixmap here, turning off the double buffering could provide some speed up. If you have time, take a look at the GtkGLExt source for synchronising Gdk and OpenGL rendering that Naofumi implemented. The function calls are gdk_gl_drawable_wait_gl and gdk_gl_drawable_wait_gdk in C. Anyway, just some thoughts. Regards, Alif Wahid. Heaven on earth can only be in one distant peaceful corner of the world...New Zealand. _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
