draw event not firing under Python 3?
- From: Michael Droettboom <mdboom gmail com>
- To: python-hackers-list gnome org
- Subject: draw event not firing under Python 3?
- Date: Thu, 17 Nov 2011 11:32:16 -0500
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.
Mike
--
Michael Droettboom
http://www.droettboom.com/
#!/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)
window.add(da)
da.connect('draw', self.on_draw_event)
da.set_events(da.get_events() | Gdk.EventMask.EXPOSURE_MASK)
window.show_all()
def on_draw_event(self, widget, ctx):
print("draw_event")
def main(demoapp=None):
app = TestApp()
Gtk.main()
if __name__ == '__main__':
main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]