Blame platform-demos/C/scrolledwindow.py.page

Packit 1470ea
Packit 1470ea
Packit 1470ea
      xmlns:its="http://www.w3.org/2005/11/its"
Packit 1470ea
      xmlns:xi="http://www.w3.org/2001/XInclude"
Packit 1470ea
      type="guide" style="task"
Packit 1470ea
      id="scrolledwindow.py">
Packit 1470ea
  <info>
Packit 1470ea
    <title type="text">ScrolledWindow (Python)</title>
Packit 1470ea
    <link type="guide" xref="beginner.py#scrolling"/>
Packit 1470ea
    <link type="next" xref="paned.py"/>
Packit 1470ea
    <revision version="0.1" date="2012-05-26" status="draft"/>
Packit 1470ea
Packit 1470ea
    <credit type="author copyright">
Packit 1470ea
      <name>Marta Maria Casetti</name>
Packit 1470ea
      <email its:translate="no">mmcasetti@gmail.com</email>
Packit 1470ea
      <years>2012</years>
Packit 1470ea
    </credit>
Packit 1470ea
Packit 1470ea
    <desc>Adds scrollbars to its child widget</desc>
Packit 1470ea
  </info>
Packit 1470ea
Packit 1470ea
  <title>ScrolledWindow</title>
Packit 1470ea
  <media type="image" mime="image/png" src="media/scrolledwindow.png"/>
Packit 1470ea
  

An image in a scrolled window.

Packit 1470ea
Packit 1470ea
  <links type="section" />
Packit 1470ea
Packit 1470ea
  <section id="code">
Packit 1470ea
    <title>Code used to generate this example</title>
Packit 1470ea
    <xi:include href="samples/scrolledwindow.py" parse="text"><xi:fallback/></xi:include>
Packit 1470ea
  </section>
Packit 1470ea
  <section id="methods">
Packit 1470ea
    <title>Useful methods for a ScrolledWindow widget</title>
Packit 1470ea
    <list>
Packit 1470ea
      <item>

set_policy(hscrollbar_policy, vscrollbar_policy) where each of the arguments is one of Gtk.Policy.AUTOMATIC, Gtk.Policy.ALWAYS, Gtk.Policy.NEVER regulates whether the horizontal and vertical scrollbars should appear: with AUTOMATIC they appear only if needed, ALWAYS and NEVER are self-explanatory.

</item>
Packit 1470ea
      <item>

add_with_viewport(widget) is used to add the Gtk.Widget widget without native scrolling capabilities inside the window.

</item>
Packit 1470ea
      <item>

set_placement(window_placement) sets the placement of the contents with respect to the scrollbars for the scrolled window. The options for the argument are Gtk.CornerType.TOP_LEFT (default: the scrollbars are on the bottom and on the right of the window), Gtk.CornerType.TOP_RIGHT, Gtk.CornerType.BOTTOM_LEFT, Gtk.CornerType.BOTTOM_RIGHT.

</item>
Packit 1470ea
      <item>

set_hadjustment(adjustment) and set_vadjustment(adjustment) set the Gtk.Adjustment adjustment. 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 Gtk.Adjustment(value, lower, upper, step_increment, page_increment, page_size) where the fields are of type float. (Note that step_increment is not used in this case, it can be set to 0.)

</item>
Packit 1470ea
    </list>
Packit 1470ea
  </section>
Packit 1470ea
  <section id="references">
Packit 1470ea
    <title>API References</title>
Packit 1470ea
    

In this sample we used the following:

Packit 1470ea
    <list>
Packit 1470ea
      <item>

<link href="http://developer.gnome.org/gtk3/unstable/GtkScrolledWindow.html">GtkScrolledWindow</link>

</item>
Packit 1470ea
      <item>

<link href="http://developer.gnome.org/gtk3/unstable/gtk3-Standard-Enumerations.html">Standard Enumerations</link>

</item>
Packit 1470ea
      <item>

<link href="http://developer.gnome.org/gtk3/unstable/GtkImage.html">GtkImage</link>

</item>
Packit 1470ea
    </list>
Packit 1470ea
  </section>
Packit 1470ea
</page>