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:
#!/usr/bin/env python
import gtk
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()
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()
--
rockdoctor
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/