draw event not firing under Python 3?

I'm noticing a difference when running the same code under Python 2.7 and Python 3.2.  Under Python 2.7, the draw event is firing -- under Python 3.2, the event handler doesn't ever seem to be called.

Is this a bug, or is something else going wrong?  I am doing all of this with the packages in Ubuntu 11.10, which includes pygobject 3.0.0 for both Python versions, I believe.

See the attached code for a minimal example that reproduces the error.


Michael Droettboom

#!/usr/bin/env python
from __future__ import print_function

from gi.repository import Gtk, Gdk
import cairo
import sys

print("Gtk version", Gtk._version)
print("Gdk version", Gdk._version)
print("cairo version", cairo.version)
print("Python version", sys.version)

class TestApp:
    def __init__(self):
        self.sureface = None

        window = Gtk.Window()
        window.connect('destroy', lambda x: Gtk.main_quit())

        da = Gtk.DrawingArea()
        da.set_size_request(100, 100)
        da.connect('draw', self.on_draw_event)
        da.set_events(da.get_events() | Gdk.EventMask.EXPOSURE_MASK)


    def on_draw_event(self, widget, ctx):

def main(demoapp=None):
    app = TestApp()

if __name__ == '__main__':

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]