gtk.ButtonBox
Prev | The gtk Class Reference | Next

## gtk.ButtonBox

gtk.ButtonBox — the base class for widgets that contain multiple buttons

## Synopsis

    class gtk.ButtonBox(gtk.Box):
        def get_layout()
        def set_layout(layout_style)
        def get_child_secondary(child)
        def set_child_secondary(child, is_secondary)

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.Box
              +-- gtk.ButtonBox

## gtk.ButtonBox Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

gtk.Box Properties

"layout-style" | Read/Write | the style used to layout the buttons in the box. The layout styles are: `gtk.BUTTONBOX_SPREAD`, `gtk.BUTTONBOX_EDGE`, `gtk.BUTTONBOX_START` and `gtk.BUTTONBOX_END`.

## gtk.ButtonBox Style Properties

gtk.Widget Style Properties

"child-internal-pad-x" | Read | The amount of padding that increases a child's size on the top and bottom
"child-internal-pad-y" | Read | The amount of padding that increases a child's size on the top and bottom
"child-min-height" | Read | The minimum height of buttons inside the box.
"child-min-width" | Read | The minimum width of buttons inside the box.

## gtk.ButtonBox Child Properties

gtk.Box Child Properties

"secondary" | Read/Write | If `True`, the child appears in a secondary group of children, suitable for, e.g., help buttons.

## gtk.ButtonBox Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

## Description

A button box is used to provide a consistent layout of buttons throughout an application. The `gtk.ButtonBox` is subclassed by the `gtk.HButtonBox` and `gtk.VButtonBox` classes to provide horizontal and vertical button layouts respectively. The same effect could be achieved by using a `gtk.Box` but less conveniently.

A buttonbox provides one default layout and a default spacing value that are persistent across all widgets. The layout/spacing can then be altered by the programmer, or if desired, by the user to alter the 'feel' of a program to a small degree.

The `gtk.Box.get_spacing`() method and the `gtk.Box.set_spacing`() methods retrieve and change the default number of pixels between buttons. The `get_layout`() and `set_layout`() methods retrieve and alter the style used to spread the buttons in a button box across the container. The layout styles are: `gtk.BUTTONBOX_SPREAD`, `gtk.BUTTONBOX_EDGE`, `gtk.BUTTONBOX_START` and `gtk.BUTTONBOX_END`.

## Methods

### gtk.ButtonBox.get_layout

        def get_layout()

Returns : | the layout style used by the buttonbox

The `get_layout`() method returns the current value of the "layout-style" property. The possible values are: `gtk.BUTTONBOX_SPREAD`, `gtk.BUTTONBOX_EDGE`, `gtk.BUTTONBOX_START` and `gtk.BUTTONBOX_END`.

### gtk.ButtonBox.set_layout

        def set_layout(layout_style)

`layout_style` : | the new layout style

The `set_layout`() method sets the "layout-style" property to the value in `layout_style`. The possible values are: `gtk.BUTTONBOX_SPREAD`, `gtk.BUTTONBOX_EDGE`, `gtk.BUTTONBOX_START` and `gtk.BUTTONBOX_END`.

### gtk.ButtonBox.get_child_secondary

        def get_child_secondary(child)

`child` : | a child button of the buttonbox
Returns : | if `True`, the `child` appears in a secondary group of the button box.

### Note

This method is available in PyGTK 2.4 and above.

The `get_child_secondary`() method returns `True` if `child` should appear in a secondary group of children. See the `set_child_secondary`() method for more information.

### gtk.ButtonBox.set_child_secondary

        def set_child_secondary(child, is_secondary)

`child` : | a child button of the buttonbox
`is_secondary` : | if `True`, the `child` appears in a secondary group of the button box.

The `set_child_secondary`() method sets whether `child` should appear in a secondary group of children. The typical use of a secondary child is the help button in a dialog that is displayed away from the main group of buttons e.g. right aligned.

The secondary group appears after the other children if the style is `gtk.BUTTONBOX_START`, `gtk.BUTTONBOX_SPREAD` or `gtk.BUTTONBOX_EDGE`, and before the the other children if the style is `gtk.BUTTONBOX_END`. For horizontal button boxes, the definition of before/after depends on direction of the widget (see `gtk.Widget.set_direction()`). If the style is `gtk.BUTTONBOX_START` or `gtk.BUTTONBOX_END`, then the secondary children are aligned at the other end of the button box from the main children. For the other styles, they appear immediately next to the main children.

Prev | Up | Next
gtk.Button | Home | gtk.Calendar