Hi,

On 1 October 2011 01:47, Steven I Usdansky <usdans...@rocketmail.com> wrote:
> I think I missed something in the transition to GObject introspection.
> How do I now get my drawing area to respond to an expose event (or what
> is the new way of doing things)? The old way works:
>
[...]
>
> The "new" way, or my interpretation of it, does not work; it claims
> TypeError: <DrawingArea object at 0xaf5050
> (GtkDrawingArea at 0xa74980)>: unknown signal name: expose-event
> The "new" way:
>
> #!/usr/bin/env python
> from gi.repository import Gtk, Gdk
> class MyExample(object):
>   def __init__(self, user_data=None):
>     window = Gtk.Window()
>     window.connect("destroy", Gtk.main_quit)
>     drawing_area = Gtk.DrawingArea()
>     drawing_area.set_size_request(300,300)
>     drawing_area.connect('expose-event',self.expose)
>     window.add(drawing_area)
>     window.show_all()
>   def expose(self,widget,data):
>     print ("self_exposed")
> # ===
> if __name__ == "__main__":
>     app = MyExample()
>     Gtk.main()

In Gtk+ v3 the expose_event is now called 'draw', so change this line:
-     drawing_area.connect('expose-event',self.expose)
with:
+     drawing_area.connect('draw',self.expose)

and it should work.

Greetings,
Iñigo Serna
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to