gtk.Paned — a base class for widgets with two adjustable panes
class gtk.Paned(gtk.Container): |
|
|
gtk.Container Signal Prototypes
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( |
gtk.Paned
is the base
class for widgets with two panes, arranged either horizontally (gtk.HPaned
) or
vertically (gtk.VPaned
). Child
widgets are added to the panes of the widget with the pack1
() and
pack2
()
methods. The division between the two children is set by default from the
size requests of the children, but it can be adjusted by the user.
A paned widget draws a separator between the two child widgets and
a small handle that the user can drag to adjust the division. It does not
draw any relief around the children or around the separator. (The space in
which the separator located is called the gutter.) Often, it is useful to
put each child inside a gtk.Frame
with the
shadow type set to gtk.SHADOW_IN
so that the gutter
appears as a ridge.
Each child has two options that can be set, resize and shrink. If
resize is True
, when the gtk.Paned
is resized,
that child will expand or shrink along with the paned widget. If shrink is
True
, the child can be made smaller than it's
requisition. Setting shrink to False
allows the
application to set a minimum size. If resize is False
for
both children, the resizing behaves as if resize is True
for both children. The application can set the position of the slider by
calling the set_position
()
method.
def add1(child
)
| the widget to add |
The add1
() method adds the widget
specified by child
to the top or left pane with the
default packing parameters (resize is False
and shrink is
True
). See the pack1
()
method.
def add2(child
)
| the widget to add |
The add2
() method adds the widget
specified by child
to the bottom or right pane with
the default packing parameters (resize is True
and shrink
is True
). See the pack2
()
method.
def pack1(child
, resize
=False, shrink
=True)
| the widget to add |
| if True
child should resize when the paned is
resized |
| if True
child can be made smaller than its
minimum size request |
The pack1
() method adds the widget
specified by child
to the top or left pane with the
parameters specified by resize
and
shrink
. If resize
is
True
child
should be resized when
the paned widget is resized. If shrink
is
True
child
can be made smaller
than its minimum size request.
def pack2(child
, resize
=True, shrink
=True)
| the widget to add |
| if True
child should resize when the paned is
resized |
| if True
child can be made smaller than its
minimum size request |
The pack2
() method adds the widget
specified by child
to the bottom or right pane with
the parameters specified by resize
and
shrink
. If resize
is
True
child
should be resized when
the paned widget is resized. If shrink
is
True
child
can be made smaller
than its minimum size request.
def get_position()
Returns : | the position of the divider |
The get_position
() method returns the
position of the divider in pixels between the two panes.
def set_position(position
)
| the new pixel position of divider, a negative value means that the position is unset. |
The set_position
() method sets the
position of the divider between the two panes to the value specified by
position
and sets the "position-set" property to
True
if position
is non-negative.
If position
is negative the divider position will be
recalculated by the paned widget using the child widget requisitions and the
"position-set" property will be set to False
.
def compute_position(allocation
, child1_req
, child2_req
)
| the total space allocation in pixels for the paned widget |
| the minimum space in pixels required for the left or top child widget |
| the minimum space in pixels required for the right or bottom child widget |
The compute_position
() method computes
the position of the separator according to the specification of the
parameters: allocation
,
child1_req
and child2_req
. The
calculation is affected by the packing parameters of the child widgets
depending on whether they can resize and shrink. This method is used by
subclasses of gtk.Paned
and is
usually not needed by applications. the gtk.Widget.queue_resize
()
method must be called after this method to have the resizing
displayed.
The minimum position is 0 if child1's shrink value is
True
or the value of child1_req
,
if False
. The maximum position is the value of
allocation
if child2's shrink value is True, or the
value of (allocation
-
child2_req
), if False
. The final
calculated position will be between the minimum and maximum
positions.
def callback(paned
, user_param1
, ...
)
| the paned that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled |
The "accept-position" signal is emitted when
paned
has the focus and any of the
Return, Enter, Space keys
are pressed. This will also cause the child widget with the focus to be
activated.
def callback(paned
, user_param1
, ...
)
| the paned that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled |
The "cancel-position" signal is emitted when the
Esc key is pressed while paned
has
the focus.
def callback(paned
, reversed
, user_param1
, ...
)
| the paned that received the signal |
| if True the focus cycle
direction should be reversed |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled |
The "cycle-child-focus" signal is emitted when
F6 or Shift+F6 is
pressed while paned
has the focus.
def callback(paned
, reversed
, user_param1
, ...
)
| the paned that received the signal |
| if True the focus cycle
direction should be reversed |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled |
The "cycle-handle-focus" signal is emitted when
paned
has the focus and any of the
Tab,
Ctrl+Tab, Shift+Tab or
Ctrl+Shift+Tab keys combinations are pressed. Tab and
Ctrl+Tab set reversed
to
False
while
Shift+Tab and Ctrl+Shift+Tab set reversed
to
True
.
def callback(paned
, scrolltype
, user_param1
, ...
)
| the paned that received the signal |
| the scroll type:
gtk.SCROLL_NONE , gtk.SCROLL_JUMP ,
gtk.SCROLL_STEP_BACKWARD ,
gtk.SCROLL_STEP_FORWARD ,
gtk.SCROLL_PAGE_BACKWARD ,
gtk.SCROLL_PAGE_FORWARD ,
gtk.SCROLL_STEP_UP ,
gtk.SCROLL_STEP_DOWN ,
gtk.SCROLL_PAGE_UP ,
gtk.SCROLL_PAGE_DOWN ,
gtk.SCROLL_STEP_LEFT ,
gtk.SCROLL_STEP_RIGHT ,
gtk.SCROLL_PAGE_LEFT ,
gtk.SCROLL_PAGE_RIGHT ,
gtk.SCROLL_START or
gtk.SCROLL_END |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled |
The "move-handle" signal is emitted when
paned
has the focus and one of the following key
combinations is pressed to move the separator:
The value of scrolltype
is one of:
gtk.SCROLL_NONE
, gtk.SCROLL_JUMP
,
gtk.SCROLL_STEP_BACKWARD
,
gtk.SCROLL_STEP_FORWARD
,
gtk.SCROLL_PAGE_BACKWARD
,
gtk.SCROLL_PAGE_FORWARD
,
gtk.SCROLL_STEP_UP
,
gtk.SCROLL_STEP_DOWN
,
gtk.SCROLL_PAGE_UP
,
gtk.SCROLL_PAGE_DOWN
,
gtk.SCROLL_STEP_LEFT
,
gtk.SCROLL_STEP_RIGHT
,
gtk.SCROLL_PAGE_LEFT
,
gtk.SCROLL_PAGE_RIGHT
,
gtk.SCROLL_START
or gtk.SCROLL_END
.
The default handler for this signal moves the separator if the separator has
the focus.
def callback(paned
, user_param1
, ...
)
| the paned that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled |
The "toggle-handle-focus" signal is emitted when
paned
has the focus and F8 is
pressed to give the focus to or take the focus from the separator
handle.