summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJames Henstridge <james@daa.com.au>2001-03-30 06:35:38 +0000
committerJames Henstridge <jamesh@src.gnome.org>2001-03-30 06:35:38 +0000
commit2fa1a292a8c3056183f7e0ac77ce46551c58b853 (patch)
tree31cb9fe7b7b45bf567f435fb0a5f96e5c1f53f92 /examples
parent5d67cea99789d0c8307ad3640387f741760c7c5e (diff)
downloadpygobject-2fa1a292a8c3056183f7e0ac77ce46551c58b853.tar.gz
moved rewritten testgtk demo here
2001-03-30 James Henstridge <james@daa.com.au> * examples/pygtk-demo: moved rewritten testgtk demo here * gobjectmodule.c (pygobject_set_property): initialise the GValue to { 0, }, so set_property actually works. (pygobject_get_property): same here. * gtk/gtk.defs: updated enum/flag defs. * gtk/gdk.defs: updated enum/flag defs. * examples/gobject/signal.py (D.do_my_signal): add small example of overriding class closure for a signal introduced from python code. * codegen/h2def.py: add --onlyenums flag to only output enum defs.
Diffstat (limited to 'examples')
-rw-r--r--examples/signal.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/signal.py b/examples/signal.py
index 6fd622d2..b98bca77 100644
--- a/examples/signal.py
+++ b/examples/signal.py
@@ -3,18 +3,25 @@ import gobject
class C(gobject.GObject):
def do_my_signal(self, arg):
- print "class closure for `my_signal' called with argument", arg
+ print "C: class closure for `my_signal' called with argument", arg
gobject.signal_new("my_signal", C, gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, (gobject.TYPE_INT, ))
+class D(C):
+ def do_my_signal(self, arg):
+ print "D: class closure for `my_signal' called. Chaining up to C"
+ C.do_my_signal(self, arg)
+
def my_signal_handler(object, arg, *extra):
print "handler for `my_signal' called with argument", arg, \
"and extra args", extra
inst = C()
+inst2 = D()
print "instance id 0x%x" % id(inst)
inst.connect("my_signal", my_signal_handler, 1, 2, 3)
inst.emit("my_signal", 42)
+inst2.emit("my_signal", 42)