Generally, I have been successful in using the Gtk3 system: Windows, boxes, grids, signal handlers etc. But, no matter what I try I cannot get a DrawingArea widget to work. I suspect something is wrong with my set-up but do not know how to check. Here is a bare-bones example that really should work:
#!/usr/bin/env python3
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('draw',self.expose)
window.add(drawing_area)
window.show_all()
def expose(self,widget,cr,data):
print ("self_exposed")
# ===
if __name__ == "__main__":
app = MyExample()
Gtk.main()
When I run it I get this error:
Exception TypeError: TypeError("Couldn't find conversion for foreign struct
'cairo.Context'",) in <module 'threading' from '/usr/lib/python3.2/threading.py'>
ignored
I am using Ubuntu 12.04 and Python 3.2. I suspect something is wrong with my install but what? I have tried re-installing python-gi-cairo.
Thanks for any ideas,
Mike