[gnome-devel-docs] tutorials python: label example without subclassing



commit 5716831a256fb2a3e1d61aac72e1900a9fc4f98d
Author: Marta Maria Casetti <mmcasetti gmail com>
Date:   Tue May 22 15:00:19 2012 +0100

    tutorials python: label example without subclassing

 platform-demos/C/samples/label.py |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/platform-demos/C/samples/label.py b/platform-demos/C/samples/label.py
index e0d3915..23811f8 100644
--- a/platform-demos/C/samples/label.py
+++ b/platform-demos/C/samples/label.py
@@ -6,11 +6,9 @@ import sys
 class MyWindow(Gtk.ApplicationWindow):
     def __init__(self, app):
         Gtk.Window.__init__(self, title="Welcome to GNOME", application=app)
-        
-class MyLabel(Gtk.Label):
-    def __init__(self):
-        Gtk.Label.__init__(self)
-        self.set_text("Hello GNOME!")
+        label = Gtk.Label()
+        label.set_text("Hello GNOME!")
+        self.add(label)
         
 class MyApplication(Gtk.Application):
     def __init__(self):
@@ -20,7 +18,6 @@ class MyApplication(Gtk.Application):
         win = MyWindow(self)
         win.set_default_size(200, 100)
         win.set_position(Gtk.WindowPosition.CENTER)
-        win.add(MyLabel())
         win.show_all()
 
     def do_startup(self):



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