[gnome-devel-docs] tutorials python: an example of linkbutton



commit a2b14d86894840dcbb5c7e28157599341c0380ee
Author: Marta Maria Casetti <mmcasetti gmail com>
Date:   Wed May 23 17:40:42 2012 +0100

    tutorials python: an example of linkbutton

 platform-demos/C/linkbutton.py.page    |   33 ++++++++++++++++++++++++++++++++
 platform-demos/C/media/linkbutton.png  |  Bin 0 -> 4296 bytes
 platform-demos/C/samples/linkbutton.py |   27 ++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/linkbutton.py.page b/platform-demos/C/linkbutton.py.page
new file mode 100644
index 0000000..a51e036
--- /dev/null
+++ b/platform-demos/C/linkbutton.py.page
@@ -0,0 +1,33 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      xmlns:xi="http://www.w3.org/2001/XInclude";
+      type="guide" style="task"
+      id="linkbutton.py">
+  <info>
+    <link type="guide" xref="beginner.py#buttons"/>
+    <revision version="0.1" date="2012-05-23" status="draft"/>
+
+    <credit type="author copyright">
+      <name>Marta Maria Casetti</name>
+      <email>mmcasetti gmail com</email>
+      <years>2012</years>
+    </credit>
+
+    <desc>A button bound to an URL</desc>
+  </info>
+
+  <title>LinkButton widget</title>
+
+  <media type="image" mime="image/png" src="media/linkbutton.png"/>
+  <p>A button that links to a web page.</p>
+
+<code mime="text/x-python" style="numbered">
+<xi:include href="samples/linkbutton.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/GtkWindow.html";>GtkWindow</link></p></item>
+  <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkLinkButton.html";>GtkLinkButton</link></p></item>
+</list>
+
+</page>
diff --git a/platform-demos/C/media/linkbutton.png b/platform-demos/C/media/linkbutton.png
new file mode 100644
index 0000000..373800c
Binary files /dev/null and b/platform-demos/C/media/linkbutton.png differ
diff --git a/platform-demos/C/samples/linkbutton.py b/platform-demos/C/samples/linkbutton.py
new file mode 100644
index 0000000..a501803
--- /dev/null
+++ b/platform-demos/C/samples/linkbutton.py
@@ -0,0 +1,27 @@
+from gi.repository import GLib
+from gi.repository import Gtk
+import sys
+
+class MyWindow(Gtk.ApplicationWindow):
+    def __init__(self, app):
+        Gtk.Window.__init__(self, title="GNOME LinkButton", application=app)
+        button = Gtk.LinkButton("http://live.gnome.org";)
+        button.set_label("Link to GNOME live!")
+        self.add(button)
+
+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(250, 50)
+        win.set_position(Gtk.WindowPosition.CENTER)
+        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]