ScrolledWindow (Python) Marta Maria Casetti mmcasetti@gmail.com 2012 Adds scrollbars to its child widget ScrolledWindow

An image in a scrolled window.

Code used to generate this example
Useful methods for a ScrolledWindow widget

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.

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

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.

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.)

API References

In this sample we used the following:

GtkScrolledWindow

Standard Enumerations

GtkImage