[gnome-devel-docs] tutorials python: example of scrolledwindow
- From: Tiffany Antopolski <antopolski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] tutorials python: example of scrolledwindow
- Date: Sat, 26 May 2012 16:53:05 +0000 (UTC)
commit a210c3daf43c596d27f95e69e8d8596a79c12887
Author: Marta Maria Casetti <mmcasetti gmail com>
Date: Sat May 26 11:15:35 2012 +0100
tutorials python: example of scrolledwindow
platform-demos/C/media/scrolledwindow.png | Bin 0 -> 29973 bytes
platform-demos/C/samples/scrolledwindow.py | 39 ++++++++++++++++++++++++++++
platform-demos/C/scrolledwindow.py.page | 31 ++++++++++++++++++++++
platform-demos/Makefile.am | 3 ++
4 files changed, 73 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/media/scrolledwindow.png b/platform-demos/C/media/scrolledwindow.png
new file mode 100644
index 0000000..667e4a5
Binary files /dev/null and b/platform-demos/C/media/scrolledwindow.png differ
diff --git a/platform-demos/C/samples/scrolledwindow.py b/platform-demos/C/samples/scrolledwindow.py
new file mode 100644
index 0000000..c6b5d9b
--- /dev/null
+++ b/platform-demos/C/samples/scrolledwindow.py
@@ -0,0 +1,39 @@
+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="ScrolledWindow Example", application=app)
+ self.set_default_size(200, 200)
+
+ # the scrolledwindow
+ scrolled_window = Gtk.ScrolledWindow()
+ scrolled_window.set_border_width(10)
+ # there is always the scrollbar (otherwise: AUTOMATIC - only if needed - or NEVER)
+ scrolled_window.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS)
+
+ # an image - slightly larger than the window...
+ image = Gtk.Image()
+ image.set_from_file("gnome-image.png")
+
+ # we add the scrollbar to the image
+ scrolled_window.add_with_viewport(image)
+
+ self.add(scrolled_window)
+
+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/C/scrolledwindow.py.page b/platform-demos/C/scrolledwindow.py.page
new file mode 100644
index 0000000..a093950
--- /dev/null
+++ b/platform-demos/C/scrolledwindow.py.page
@@ -0,0 +1,31 @@
+<page xmlns="http://projectmallard.org/1.0/"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ type="guide" style="task"
+ id="scrolledwindow.py">
+ <info>
+ <link type="guide" xref="beginner.py#scrolling"/>
+ <revision version="0.1" date="2012-05-26" status="draft"/>
+
+ <credit type="author copyright">
+ <name>Marta Maria Casetti</name>
+ <email>mmcasetti gmail com</email>
+ <years>2012</years>
+ </credit>
+
+ <desc>Adds scrollbars to its child widget</desc>
+ </info>
+
+ <title>ScrolledWindow</title>
+ <media type="image" mime="image/png" src="media/scrolledwindow.png"/>
+ <p>An image in a scrolled window.</p>
+
+<code mime="text/x-python" style="numbered"><xi:include href="samples/scrolledwindow.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/GtkScrolledWindow.html">GtkScrolledWindow</link></p></item>
+ <item><p><link href="http://developer.gnome.org/gtk3/3.4/gtk3-Standard-Enumerations.html">Standard Enumerations</link></p></item>
+ <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkImage.html">GtkImage</link></p></item>
+</list>
+</page>
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index 76143cf..319753c 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -58,6 +58,7 @@ demo_sources = \
samples/radiobutton.py \
samples/radiobutton.vala \
samples/scale.py \
+ samples/scrolledwindow.py \
samples/spinbutton.py \
samples/spinner.py \
samples/spinner.vala \
@@ -107,6 +108,7 @@ DOC_FIGURES = \
media/radiobutton.png \
media/record-collection.png \
media/scale.png \
+ media/scrolledwindow.png \
media/spinbutton.png \
media/spinner.png \
media/statusbar.png \
@@ -192,6 +194,7 @@ DOC_PAGES = \
radiobutton.vala.page \
record-collection.js.page \
scale.py.page \
+ scrolledwindow.py.page \
spinbutton.py.page \
spinner.py.page \
spinner.vala.page \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]