[gnome-devel-docs] Python samples: GtkApplicationWindow



commit 20c114c393b1461c8aee0610f70e20f6182bfaa4
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date:   Wed May 2 01:39:40 2012 -0400

    Python samples: GtkApplicationWindow

 platform-demos/C/GtkApplicationWindow.py.page    |   32 ++++++++++++++++++++++
 platform-demos/C/samples/GtkApplicationWindow.py |   23 +++++++++++++++
 platform-demos/Makefile.am                       |    2 +
 3 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/GtkApplicationWindow.py.page b/platform-demos/C/GtkApplicationWindow.py.page
new file mode 100644
index 0000000..30fc863
--- /dev/null
+++ b/platform-demos/C/GtkApplicationWindow.py.page
@@ -0,0 +1,32 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      xmlns:xi="http://www.w3.org/2001/XInclude";
+      type="guide" style="task"
+      id="GtkApplicationWindow.py">
+  <info>
+    <link type="guide" xref="beginner.py#windows"/>
+    <revision version="0.1" date="2012-04-07" status="draft"/>
+
+    <credit type="author copyright">
+      <name>Tiffany Antopolski</name>
+      <email>tiffany antopolski gmail com</email>
+      <years>2012</years>
+    </credit>
+
+    <desc>GtkWindow subclass with GtkApplication support</desc>
+  </info>
+
+  <title>ApplicationWindow</title>
+  <media type="image" mime="image/png" src="media/window.png"/>
+  <p>The simplest GtkApplication Window which can support Menus.</p>
+
+<code mime="text/x-python" style="numbered">
+<xi:include href="samples/GtkApplicationWindow.py" parse="text"><xi:fallback/></xi:include>
+</code>
+<p>
+  In this sample we used the following:
+</p>
+<list>
+  <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkApplication.html";>GtkApplication</link></p></item>
+  <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkApplicationWindow.html";>GtkApplicationWindow</link></p></item>
+</list>
+</page>
diff --git a/platform-demos/C/samples/GtkApplicationWindow.py b/platform-demos/C/samples/GtkApplicationWindow.py
new file mode 100644
index 0000000..13ed58a
--- /dev/null
+++ b/platform-demos/C/samples/GtkApplicationWindow.py
@@ -0,0 +1,23 @@
+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 MyApplication(Gtk.Application):
+    def __init__(self):
+        Gtk.Application.__init__(self, application_id="org.gtk.example.grid")
+
+    def do_activate(self):
+        win = MyWindow(self)
+        win.show_all()
+
+    def do_startup (self):
+        Gtk.Application.do_startup (self)
+
+app = MyApplication()
+exit_status = app.run(sys.argv)
+sys.exit(exit_status)
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index 1166324..9db216c 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -29,6 +29,7 @@ demo_sources = \
 	samples/grid.py				\
 	samples/GtkApplicationWindow.c		\
         samples/GtkApplicationWindow.js		\
+	samples/GtkApplicationWindow.py		\
 	samples/GtkApplicationWindow.vala	\
 	samples/label.vala			\
 	samples/messagedialog.vala		\
@@ -90,6 +91,7 @@ DOC_PAGES =				\
 	grid.py.page			\
 	GtkApplicationWindow.c.page	\
 	GtkApplicationWindow.js.page	\
+	GtkApplicationWindow.py.page	\
 	GtkApplicationWindow.vala.page	\
 	guitar-tuner.c.page		\
 	guitar-tuner.cpp.page		\



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