Gtk.ButtonBox


Gtk.ButtonBox — A container for arranging buttons

Object Hierarchy:

    GObject
    ╰── GInitiallyUnowned
        ╰── Gtk.Widget
            ╰── Gtk.Container
                ╰── Gtk.Box
                    ╰── Gtk.ButtonBox
                        ├── Gtk.HButtonBox
                        ╰── Gtk.VButtonBox

Functions:

Description:

A button box should be used to provide a consistent layout of buttons throughout your application. The layout/spacing can be altered by the programmer, or if desired, by the user to alter the “feel” of a program to a small degree.

gtk_button_box_get_layout() and gtk_button_box_set_layout() retrieve and alter the method used to spread the buttons in a button box across the container, respectively.

The main purpose of GtkButtonBox is to make sure the children have all the same size. GtkButtonBox gives all children the same size, but it does allow 'outliers' to keep their own larger size.

To exempt individual children from homogeneous sizing regardless of their 'outlier' status, you can set the non-homogeneous child property.


Function Details:

new()

new (orientation:Gtk.Orientation) -> Gtk.Widget

Creates a new Gtk.ButtonBox.

  • Returns: a new Gtk.ButtonBox.

  • Since: 3.0


get_layout()

get_layout (self) -> Gtk.ButtonBoxStyle

Retrieves the method being used to arrange the buttons in a button box.

  • Returns: the method used to lay out buttons in widget.

get_child_secondary()

get_child_secondary (self, child:Gtk.Widget) -> bool

Returns whether child should appear in a secondary group of children.

  • Returns: whether childshould appear in a secondary group of children.

  • Since: 2.4


get_child_non_homogeneous()

get_child_non_homogeneous (self, child:Gtk.Widget) -> bool

Returns whether the child is exempted from homogenoussizing.

  • Returns: True if the child is not subject to homogenous sizing

  • Since: 3.2


set_layout()

set_layout (self, layout_style:Gtk.ButtonBoxStyle)

Changes the way buttons are arranged in their container.


set_child_secondary()

set_child_secondary (self, child:Gtk.Widget, is_secondary:bool)

Sets whether child should appear in a secondary group of children.A typical use of a secondary child is the help button in a dialog. This group appears after the other children if the styleis GTK_BUTTONBOX_START, GTK_BUTTONBOX_SPREAD orGTK_BUTTONBOX_EDGE, and before the other children if the styleis GTK_BUTTONBOX_END. For horizontal button boxes, the definitionof before/after depends on direction of the widget (see`Gtk.Widget:set_direction()). If the style isGTK_BUTTONBOX_STARTorGTK_BUTTONBOX_END`, then the secondary children are aligned atthe other end of the button box from the main children. For theother styles, they appear immediately next to the main children.


set_child_non_homogeneous()

set_child_non_homogeneous (self, child:Gtk.Widget, non_homogeneous:bool)

Sets whether the child is exempted from homogeous sizing.

  • Since: 3.2

Example:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

class ButtonBox(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self)
        self.set_title("ButtonBox")
        self.connect("destroy", Gtk.main_quit)

        buttonbox = Gtk.ButtonBox()
        buttonbox.set_orientation(Gtk.Orientation.HORIZONTAL)
        buttonbox.set_spacing(2)
        self.add(buttonbox)

        button = Gtk.Button(label="Sparrow")
        buttonbox.add(button)
        button = Gtk.Button(label="Wren")
        buttonbox.add(button)
        button = Gtk.Button(label="Great Spotted Woodpecker")
        buttonbox.add(button)

window = ButtonBox()
window.show_all()

Gtk.main()

results matching ""

    No results matching ""