[gnome-devel-docs] tutorials python: label example without subclassing
- From: Tiffany Antopolski <antopolski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] tutorials python: label example without subclassing
- Date: Tue, 22 May 2012 22:32:54 +0000 (UTC)
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]