"hadjustment"Read-Write-ConstructThe gtk.Adjustment
for the horizontal position.hscrollbar-policy""Read-WriteThe horizontal scrollbar display policy; one of:
gtk.POLICY_ALWAYS,
gtk.POLICY_AUTOMATIC or
gtk.POLICY_NEVER."shadow-type"Read-WriteThe style of bevel around the contents; one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN,
gtk.SHADOW_ETCHED_OUT."vadjustment"Read-Write-ConstructThe gtk.Adjustment
for the vertical position."vscrollbar-policy"Read-WriteThe vertical scrollbar display policy; one of:
gtk.POLICY_ALWAYS,
gtk.POLICY_AUTOMATIC or
gtk.POLICY_NEVER."window-placement"Read-WriteWhere the contents are located with respect to the
scrollbars; one of: gtk.CORNER_TOP_LEFT,
gtk.CORNER_BOTTOM_LEFT,
gtk.CORNER_TOP_RIGHT,
gtk.CORNER_BOTTOM_RIGHT."window-placement-set"Read-WriteIf True "window-placement" should be
used to determine the location of the contents with respect to the
scrollbars.
"scrollbar-spacing"ReadThe number of pixels between the scrollbars and the
scrolled window. Available in GTK+ 2.2 and
above."scrollbar-within-bevel"ReadWhether to place scrollbars within the scrolled window's bevel.
Default value: False
Available in GTK+ 2.12 and
above.
gtk.ScrolledWindow Signal Prototypesgobject.GObject Signal Prototypesgtk.Object Signal Prototypesgtk.Widget Signal Prototypesgtk.Container Signal Prototypes"move-focus-out"callbackscrolledwindowdirectionuser_param1..."scroll-child"callbackscrolledwindowscrolltypehorizontaluser_param1...DescriptionA gtk.ScrolledWindow
is a subclass of gtk.Bin that adds
scrollbars to a single child widget and optionally draws a beveled frame
around the child widget. The scrolled window can work in two ways:Some widgets have native scrolling support using "slots" to
hold gtk.Adjustment
objects. Widgets with native scroll support include gtk.TreeView,
gtk.TextView, and
gtk.Layout.Widgets that lack native scrolling support use the gtk.Viewport
widget that acts as an adapter class, implementing scrollability for child
widgets that lack their own scrolling capabilities. Use gtk.Viewport to
scroll child widgets such as gtk.Table, gtk.Box, and so
on.If a widget has native scrolling abilities, it can be added to the
gtk.ScrolledWindow
with the gtk.Container.add()
method. If a widget does not, you must first add the widget to a gtk.Viewport, then
add the gtk.Viewport to
the scrolled window. The convenience method add_with_viewport()
does exactly this, so you can ignore the presence of the viewport.The position of the scrollbars is controlled by the scroll
adjustments. The gtk.ScrolledWindow
uses the attributes in an adjustment (see gtk.Adjustment)
as follows:the adjustment.lower attribute is the
minimum value of the scroll regionthe adjustment.upper attribute is the
maximum value of the scroll regionthe adjustment.value attribute
represents the position of the scrollbar, which must be between
adjustment.lower and adjustment.upper
- adjustment.page_sizethe adjustment.page_size attribute
represents the size of the visible scrollable areathe adjustment.step_increment attribute
is the distance to scroll when the small stepper arrows are
clickedthe adjustment.page_increment attribute
is the distance to scroll when the Page Up or Page
Down keys are pressedIf a gtk.ScrolledWindow
doesn't behave quite as you would like, or doesn't have exactly the right
layout, it's very possible to set up your own scrolling with gtk.Scrollbar and
for example a gtk.Table.Constructorgtk.ScrolledWindowhadjustmentNonevadjustmentNonehadjustment :the horizontal gtk.Adjustment
or Nonevadjustment :a
vertical gtk.Adjustment
or NoneReturns :a new gtk.ScrolledWindow
widgetCreates a new scrolled window with the horizontal and vertical
gtk.Adjustment
specified by hadjustment and
vadjustment respectively. These will be shared with
the scrollbars and the child widget to keep the bars in sync with the child.
If hadjustment and vadjustment
are None or not specified the scrolled window will create
them for you.Methodsgtk.ScrolledWindow.set_hadjustmentset_hadjustmenthadjustmenthadjustment :the horizontal gtk.AdjustmentThe set_hadjustment() method sets the
horizontal adjustment (and the "hadjustment" property) to the value of
hadjustment. hadjustment must
be a gtk.Adjustment.gtk.ScrolledWindow.set_vadjustmentset_vadjustmentvadjustmentvadjustment :the vertical gtk.AdjustmentThe set_vadjustment() method sets the
vertical adjustment (and the "vadjustment" property) to the value of
vadjustment. vadjustment must
be a gtk.Adjustment.gtk.ScrolledWindow.get_hadjustmentget_hadjustmentReturns :the horizontal gtk.AdjustmentThe get_hadjustment() method returns
the value of the "hadjustment" property which is a reference to the
horizontal adjustment.gtk.ScrolledWindow.get_vadjustmentget_vadjustmentReturns :the vertical gtk.AdjustmentThe get_vadjustment() method returns
the value of the "vadjustment" property which is a reference to the vertical
adjustment.gtk.ScrolledWindow.get_hscrollbarget_hscrollbarReturns :The horizontal scrollbar of the scrolled window
or None if it does not exist.This method is available in PyGTK 2.8 and above.The get_hscrollbar() method returns the
gtk.HScrollbar
for the scrolled window or None if there is no horizontal
scrollbar.gtk.ScrolledWindow.get_vscrollbarget_vscrollbarReturns :The vertical scrollbar of the scrolled window
or None if it does not exist.This method is available in PyGTK 2.8 and above.The get_vscrollbar() method returns the
gtk.VScrollbar
for the scrolled window or None if there is no vertical
scrollbar.gtk.ScrolledWindow.set_policyset_policyhscrollbar_policyvscrollbar_policyhscrollbar_policy :the policy for the horizontal
scrollbarvscrollbar_policy :the policy for the vertical
scrollbarThe set_policy() method sets the
"hscrollbar_policy" and "vscrollbar_policy" properties to the value of
hscrollbar_policy and
vscrollbar_policy respectively. The policy determines
when the scrollbar should be displayed. The policy value is one of:gtk.POLICY_ALWAYSthe scrollbar is always presentgtk.POLICY_AUTOMATICthe scrollbar is present only if needed i.e. the
contents are larget than the windowgtk.POLICY_NEVERthe scrollbar is never presentgtk.ScrolledWindow.get_policyget_policyReturns> :a tuple containing the horizontal and vertical
scrollbar policiesThe get_policy() method returns a tuple
containing the horizontal and vertical scrollbar policies. See the set_policy() method for more detail.gtk.ScrolledWindow.set_placementset_placementwindow_placementwindow_placement :the placement of the contents with respect to
the scrollbarsThe set_placement() method sets the
"window-placement" property to the value specified by
window_placement. The window placement determines the
location of the child widget with respect to the scrollbars.
window_placement must be one of:gtk.CORNER_TOP_LEFTPlace the scrollbars on the right and bottom of the
widget (default behavior).gtk.CORNER_BOTTOM_LEFTPlace the scrollbars on the top and right of the
widget.gtk.CORNER_TOP_RIGHTPlace the scrollbars on the left and bottom of the
widget.gtk.CORNER_BOTTOM_RIGHTPlace the scrollbars on the top and left of the
widget.gtk.ScrolledWindow.get_placementget_placementReturns :the current placement
value.The get_placement() method returns the
value of the "window-placement" property that determines the placement of
the scrollbars with respect to the scrolled window. See the set_placement()
method for more detail.gtk.ScrolledWindow.set_shadow_typeset_shadow_typetypetype :the kind of bevel shadow to draw around the
scrolled window contentsThe set_shadow_type() method sets the
value of the "shadow-type" property to the value of
shadow_type. shadow_type
determines the type of bevel shadow drawn around the contents of the
scrolled window. The shadow type must be one of:gtk.SHADOW_NONENo outline.gtk.SHADOW_INThe outline is beveled inward.gtk.SHADOW_OUTThe outline is beveled outward.gtk.SHADOW_ETCHED_INThe outline is an inward etched bevel.gtk.SHADOW_ETCHED_OUTThe outline is an outward etched bevel.gtk.ScrolledWindow.get_shadow_typeget_shadow_typeReturns :the current shadow typeThe get_shadow_type() method returns
the value of the "shadow-type" property that determines the shadow type of
the scrolled window. See the set_shadow_type()
method for more detail.gtk.ScrolledWindow.add_with_viewportadd_with_viewportchildchild :the widget to be scrolledThe add_with_viewport() method is used
to add a widget (specified by child) without native
scrolling capabilities to the scrolled window. This is a convenience
function that is equivalent to adding child to a
gtk.Viewport, then
adding the viewport to the scrolled window. If a child has native scrolling
(e.g. gtk.TextView,
gtk.TreeView,
gtk.Layout),
use gtk.Container.add()
instead of this method.The viewport scrolls the child by moving its gtk.gdk.Window,
and takes the size of the child to be the size of its toplevel gtk.gdk.Window.
This will be wrong for most widgets that support native scrolling. For
example, if you add a widget such as gtk.TreeView with
a viewport, the whole widget will scroll, including the column
headings.SignalsThe "move-focus-out" gtk.ScrolledWindow Signalcallbackscrolledwindowdirectionuser_param1...scrolledwindow :the scrolledwindow that received the
signaldirection :the direction that the focus is moving either
gtk.DIR_TAB_FORWARD or
gtk.DIR_TAB_BACKWARD.user_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "move-focus-out" signal is emitted when the user presses
ControlTab or ControlShiftTab to move the focus out of the scrolled window. The
direction is either
gtk.DIR_TAB_FORWARD or
gtk.DIR_TAB_BACKWARDThe "scroll-child" gtk.ScrolledWindow Signalcallbackscrolledwindowscrolltypehorizontaluser_param1...scrolledwindow :the scrolledwindow that received the
signalscrolltype :the scroll type; one of:
gtk.SCROLL_STEP_BACKWARD,
gtk.SCROLL_STEP_FORWARD,
gtk.SCROLL_PAGE_BACKWARD,
gtk.SCROLL_PAGE_FORWARD,
gtk.SCROLL_PAGE_UP,
gtk.SCROLL_PAGE_DOWN, gtk.SCROLL_START
or gtk.SCROLL_END.horizontal :if True scroll in the horizontal
directionuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "scroll-child" signal is emitted when the child widget is
being scrolled by a keyboard action. The default key bindings with resulting
scrolltype and horizontal
arguments are:ControlLeft Arrowgtk.SCROLL_STEP_BACKWARD -
horizontalControlRight Arrowgtk.SCROLL_STEP_FORWARD -
horizontalControlUp Arrowgtk.SCROLL_STEP_BACKWARD -
verticalControlDown Arrowgtk.SCROLL_STEP_FORWARD -
verticalControlPage Upgtk.SCROLL_PAGE_BACKWARD -
horizontalControlPage Downgtk.SCROLL_PAGE_FORWARD -
horizontalPage Upgtk.SCROLL_PAGE_BACKWARD -
verticalPage Downgtk.SCROLL_PAGE_FORWARD -
verticalControlHomegtk.SCROLL_START -
horizontalControlEndgtk.SCROLL_END -
horizontalHomegtk.SCROLL_START -
verticalEndgtk.SCROLL_END - vertical