[gnome-devel-docs] tutorials python: page on scrolledwindow widget rewritten
- From: Tiffany Antopolski <antopolski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] tutorials python: page on scrolledwindow widget rewritten
- Date: Sat, 23 Jun 2012 00:59:38 +0000 (UTC)
commit 60e00a53f0ed1b54daa4124f416afd55bfa224a7
Author: Marta Maria Casetti <mmcasetti gmail com>
Date: Fri Jun 22 21:32:28 2012 +0100
tutorials python: page on scrolledwindow widget rewritten
platform-demos/C/samples/scrolledwindow.py | 7 ++---
platform-demos/C/scrolledwindow.py.page | 33 ++++++++++++++++++++-------
2 files changed, 27 insertions(+), 13 deletions(-)
---
diff --git a/platform-demos/C/samples/scrolledwindow.py b/platform-demos/C/samples/scrolledwindow.py
index c6b5d9b..05137b7 100644
--- a/platform-demos/C/samples/scrolledwindow.py
+++ b/platform-demos/C/samples/scrolledwindow.py
@@ -1,6 +1,4 @@
-from gi.repository import GLib
from gi.repository import Gtk
-from gi.repository import Gio
import sys
class MyWindow(Gtk.ApplicationWindow):
@@ -18,14 +16,15 @@ class MyWindow(Gtk.ApplicationWindow):
image = Gtk.Image()
image.set_from_file("gnome-image.png")
- # we add the scrollbar to the image
+ # add the image to the scrolledwindow
scrolled_window.add_with_viewport(image)
+ # add the scrolledwindow to the window
self.add(scrolled_window)
class MyApplication(Gtk.Application):
def __init__(self):
- Gtk.Application.__init__(self, application_id="org.gtk.example.grid")
+ Gtk.Application.__init__(self)
def do_activate(self):
win = MyWindow(self)
diff --git a/platform-demos/C/scrolledwindow.py.page b/platform-demos/C/scrolledwindow.py.page
index b20a781..7222af5 100644
--- a/platform-demos/C/scrolledwindow.py.page
+++ b/platform-demos/C/scrolledwindow.py.page
@@ -20,13 +20,28 @@
<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>
+ <links type="section" />
+
+ <section id="code">
+ <title>Code used to generate this example</title>
+ <code mime="text/x-python" style="numbered"><xi:include href="samples/scrolledwindow.py" parse="text"><xi:fallback/></xi:include></code>
+ </section>
+ <section id="methods">
+ <title>Useful methods for a ScrolledWindow widget</title>
+ <list>
+ <item><p><code>set_policy(hscrollbar_policy, vscrollbar_policy)</code> where each of the arguments is one of <code>Gtk.Policy.AUTOMATIC, Gtk.Policy.ALWAYS, Gtk.Policy.NEVER</code> regulates whether the horizontal and vertical scrollbars should appear: with <code>AUTOMATIC</code> they appear only if needed, <code>ALWAYS</code> and <code>NEVER</code> are self-explanatory.</p></item>
+ <item><p><code>add_with_viewport(widget)</code> is used to add the Gtk.Widget <code>widget</code> without native scrolling capabilities inside the window.</p></item>
+ <item><p><code>set_placement(window_placement)</code> sets the placement of the contents with respect to the scrollbars for the scrolled window. The options for the argument are <code>Gtk.CornerType.TOP_LEFT</code> (default: the scrollbars are on the bottom and on the right of the window), <code>Gtk.CornerType.TOP_RIGHT, Gtk.CornerType.BOTTOM_LEFT, Gtk.CornerType.BOTTOM_RIGHT</code>.</p></item>
+ <item><p><code>set_hadjustment(adjustment)</code> and <code>set_vadjustment(adjustment)</code> set the Gtk.Adjustment <code>adjustment</code>. This is the representation of a value with a lower and upper bound, together with step and page increments, and a page size, and it is constructed as <code>Gtk.Adjustment(value, lower, upper, step_increment, page_increment, page_size)</code> where the fields are of type <code>float</code>. (Note that <code>step_increment</code> is not used in this case, it can be set to <code>0</code>.)</p></item>
+ </list>
+ </section>
+ <section id="references">
+ <title>API References</title>
+ <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>
+ </section>
</page>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]