[gnome-devel-docs] tutorial python: window displaying a label with some text
- From: Tiffany Antopolski <antopolski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] tutorial python: window displaying a label with some text
- Date: Mon, 7 May 2012 12:04:55 +0000 (UTC)
commit 4a992a0599b76f2641b6c16361abc0568e7ed585
Author: Marta Maria Casetti <mmcasetti gmail com>
Date: Mon May 7 08:04:40 2012 +0100
tutorial python: window displaying a label with some text
platform-demos/C/label.py.page | 25 +++++++++++++++++++++++++
platform-demos/C/samples/label.py | 31 +++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/label.py.page b/platform-demos/C/label.py.page
new file mode 100644
index 0000000..8f5ea61
--- /dev/null
+++ b/platform-demos/C/label.py.page
@@ -0,0 +1,25 @@
+<page xmlns="http://projectmallard.org/1.0/"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ type="guide" style="task"
+ id="label.py">
+ <info>
+ <link type="guide" xref="beginner.py#display-widgets"/>
+ <revision version="0.1" date="2012-04-28" status="review"/>
+
+ <credit type="author copyright">
+ <name>Marta Maria Casetti</name>
+ <email>mmcasetti gmail com</email>
+ <years>2012</years>
+ </credit>
+
+ <desc>A widget which displays text</desc>
+ </info>
+
+ <title>Label</title>
+ <media type="image" mime="image/png" src="media/label.png"/>
+ <p>A simple label</p>
+
+<code mime="text/x-vala" style="numbered">
+<xi:include href="samples/label.py" parse="text"><xi:fallback/></xi:include>
+</code>
+</page>
diff --git a/platform-demos/C/samples/label.py b/platform-demos/C/samples/label.py
new file mode 100644
index 0000000..e0d3915
--- /dev/null
+++ b/platform-demos/C/samples/label.py
@@ -0,0 +1,31 @@
+from gi.repository import GLib
+from gi.repository import Gtk
+from gi.repository import Gio
+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!")
+
+class MyApplication(Gtk.Application):
+ def __init__(self):
+ Gtk.Application.__init__(self, application_id="org.gtk.example.grid")
+
+ def do_activate(self):
+ 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):
+ Gtk.Application.do_startup(self)
+
+app = MyApplication()
+exit_status = app.run(sys.argv)
+sys.exit(exit_status)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]