GLXCurses.Box module

class GLXCurses.Box.Box[source]

Bases: GLXCurses.Container.Container

Description:

The Box widget organizes child widgets into a rectangular area.

baseline_position

Gets the baseline_position value.

Returns:a GLXC.BaselinePosition
Return type:GLXC.BaselinePosition
homogeneous

Returns whether the Box is homogeneous (all children’s have the same size).

See also

Box.set_homogeneous()

Returns:True if the Box is homogeneous.
Return type:bool
spacing
new(orientation='HORIZONTAL', spacing=None)[source]

Creates a new Box.

Parameters:
  • orientation (Orientation) – the box’s orientation. Default: ORIENTATION_HORIZONTAL
  • spacing (int or None) – the number of characters to place by default between children. Default: 0
Returns:

a new Box.

Raises:
  • TypeError – if orientation is not glxc.ORIENTATION_HORIZONTAL or glxc.ORIENTATION_VERTICAL
  • TypeError – if spacing is not int type or None
pack_start(child=None, expand=True, fill=True, padding=None)[source]

Adds child to Box , packed with reference to the start of Box.

Parameters:
  • child (a GLXCures Object) – the widget to be added to Box
  • expand (bool) – True if the new child is to be given extra space allocated to Box <GLXCurses.Box.Box>. The extra space will be divided evenly between all children that use this option
  • fill (bool) – True if space given to child by the expend option is actually allocated to child, rather than just padding it. This parameter has no effect if expend is set to False. A child is always allocated the full height of a horizontal Box and the full width of a vertical Box. This option affects the other dimension.
  • padding (int or None) – extra space in characters to put between this child and its neighbors, over and above the global amount specified by spacing attribute. If child is a widget at one of the reference ends of box , then padding pixels are also put between child and the reference edge of box
Raises:
  • TypeError – if child is not a GLXCurses type as tested by glxc_type()
  • TypeError – if expand is not bool type
  • TypeError – if fill is not bool type
  • TypeError – if padding is not int or None
pack_end(child=None, expand=True, fill=True, padding=None)[source]

Adds child to GLXCurses.Box once to the end of GLXCurses.Box .

Parameters:
  • child (GLXCurses.Widget) – the widget to be added to GLXCurses.Box
  • expand (bool) – True if the new child is to be given extra space allocated to GLXCurses.Box . The extra space will be divided evenly between all children that use this option
  • fill (bool) – True if space given to child by the expend option is actually allocated to child, rather than just padding it. This parameter has no effect if expend is set to False. A child is always allocated the full height of a horizontal Box and the full width of a vertical Box. This option affects the other dimension.
  • padding (int or None) – extra space in characters to put between this child and its neighbors, over and above the global amount specified by spacing attribute. If child is a widget at one of the reference ends of box , then padding pixels are also put between child and the reference edge of box
Raises:
  • TypeError – if child is not a instance of LXCurses.Widget
  • TypeError – if expand is not bool type
  • TypeError – if fill is not bool type
  • TypeError – if padding is not int or None
reorder_child(child, position)[source]

Moves child to a new position in the list of Box children. The list contains widgets packed PACK_START as well as widgets packed PACK_END, in the order that these widgets were added to Box.

A widget’s position in the Box children list determines where the widget is packed into Box. A child widget at some position in the list will be packed just after all other widgets of the same packing type that appear earlier in the list.

Parameters:
  • child (Widget) – the widget to move
  • position (int) – the new position for child in the list of children of Box, starting from 0. If negative, indicates the end of the list.
Raises:
  • TypeError – if child is not a GLXCurses type as tested by glxc_type()
  • TypeError – if position is not int type
  • TypeError – if child is not a GLXCurses type as tested by glxc_type()
query_child_packing(child)[source]

Obtains information about how child is packed into box or None if child is not found

Return Key’s:
widget: the Widget of the child to query expand: expand child property. fill: fill child property padding: padding child property. pack_type: pack-type child property
Parameters:child (a Galaxie Widget) – the Widget of to query
Returns:information about how child is packed into box
Return type:dict or None
Raises:TypeError – if child is not a GLXCurses type as tested by glxc_type()
set_child_packing(child, expand, fill, padding, pack_type)[source]

Sets the way child is packed into box .

Parameters:
  • child (Widget) – the Widget of the child to set
  • expand (bool) – the new value of the expand child property
  • fill (bool) – the new value of the fill child property
  • padding (int) – the new value of the padding child property
  • pack_type (PackType) – the new value of the pack-type child property
Raises:
  • TypeError – if child is not bool type
  • TypeError – if expand is not bool type
  • TypeError – if padding is not int or None
  • TypeError – if pack_type is not glxc.PACK_START or glxc.PACK_END
set_center_widget(widget=None)[source]

Sets a center widget; that is a child widget that will be centered with respect to the full width of the box, even if the children at either side take up different amounts of space.

Parameters:widget (Widget or None) – the Widget of the child to set
Raises:TypeError – if widget is not a GLXCurses type as tested by glxc_type() or None
get_center_widget()[source]

Retrieves the center widget of the box.

Returns:the center widget or None in case no center widget is set.