Hi,
as a part of a custom widget that inherits gtk.DrawingArea:
def do_realize(self):
self.window = gtk.gdk.Window(
self.get_parent_window(),
self.allocation.width,
self.allocation.height,
gtk.gdk.WINDOW_CHILD,
gtk.gdk.INPUT_OUTPUT,
self.get_events() | gtk.gdk.EXPOSURE_MASK)
self.window.set_user_data(self)
self.style.attach(self.window)
img = gtk.Image()
img.set_from_file(self.pathname)
self.pixbuf = img.get_pixbuf()
self.set_flags(self.flags() | gtk.REALIZED)
def do_expose_event(self, event):
gc = self.window.new_gc(clip_mask=round(self.window, 20,
self.allocation))
self.window.draw_pixbuf(gc, self.pixbuf, 0,0,0,0)
Self.window is set just fine in do_realize, and passes the type sanity
check as being a gtk.gdk.Window. On the other hand, it is None in
do_expose_event and self.flags() & gtk.REALIZED is zero. Should I not be
overriding do_realize? Or maybe not subclassing gtk.DrawingArea at all,
but rather encapsulating it?
Also do_expose_event is not being called at all, even if I
self.connect('expose-event', self.do_expose_event) in self.__init__.
Do_realize and (snipped) do_size_allocate are called appropriately. The
correct amount of space is reserved for the widget when used.
--
-,Bjartur
_______________________________________________
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/