gtk.Buildable
Prev | The gtk Class Reference | Next

## gtk.Buildable

gtk.Buildable — Interface for objects that can be built by GtkBuilder.

## Synopsis

    class gtk.Buildable(gobject.GInterface):
        def add_child(builder, child, type)
        def construct_child(builder, name)
        def get_internal_child(builder, childname)
        def get_name()
        def parser_finished(builder)
        def set_name(name)

## Ancestry

    +-- gobject.GInterface
      +-- gtk.Buildable

## Known Implementation

`gtk.Buildable` is implementated by `gtk.Bin`, `gtk.TreeView`, `gtk.ButtonBox`, `gtk.Paned`, `gtk.ColorSelectionDialog`, `gtk.VButtonBox`, `gtk.TearoffMenuItem`, `gtk.Entry`, `gtk.OptionMenu`, `gtk.Image`, `gtk.Calendar`, `gtk.Fixed`, `gtk.LinkButton`, `gtk.HButtonBox`, `gtk.InputDialog`, `gtk.RadioButton`, `gtk.VRuler`, `gtk.VSeparator`, `gtk.VBox`, `gtk.Curve`, `gtk.RadioToolButton`, `gtk.HRuler`, `gtk.ToggleButton`, `gtk.SeparatorMenuItem`, `gtk.HScale`, `gtk.Table`, `gtk.TreeViewColumn`, `gtk.ImageMenuItem`, `gtk.FileChooserButton`, `gtk.CheckButton`, `gtk.RadioMenuItem`, `gtk.MenuShell`, `gtk.StatusBar`, `gtk.DrawingArea`, `gtk.Button`, `gtk.IconView`, `gtk.Notebook`, `gtk.UIManager`, `gtk.Socket`, `gtk.VScale`, `gtk.GammaCurve`, `gtk.Alignment`, `gtk.MenuToolButton`, `gtk.MenuItem`, `gtk.PageSetupUnixDialog`, `gtk.RecentChooserMenu`, `gtk.ToolItem`, `gtk.HSeparator`, `gtk.ProgressBar`, `gtk.ActionGroup`, `gtk.Range`, `gtk.Assistant`, `gtk.FileSelection`, `gtk.ToolBar`, `gtk.AccellLabel`, `gtk.RecentChooserDialog`, `gtk.Expander`, `gtk.Scale`, `gtk.TreeStore`, `gtk.MessageDialog`, `gtk.Separator`, `gtk.Layout`, `gtk.FontSelection`, `gtk.CellView`, `gtk.Invisible`, `gtk.Window`, `gtk.SeparatorToolItem`, `gtk.FileChooserWidget`, `gtk.CheckMenuItem`, `gtk.ToolButton`, `gtk.Misc`, `gtk.EventBox`, `gtkFontButton.`, `gtk.EntryCompletion`, `gtk.Dialog`, `gtk.HBox`, `gtk.Combo`, `gtk.AspectFrame`, `gtk.AboutDialog`, `gtk.HScrollBar`, `gtk.Liststore`, `gtk.ScaleButton`, `gtk.RecentChooserWidget`, `gtk.ToggleToolButton`, `gtk.ComboBox`, `gtk.VScrollBar`, `gtk.Frame`, `gtk.SpinButton`, `gtk.Label`, `gtk.FontSelectionDialog`, `gtk.ColorSelection`, `gtk.Item`, `gtk.Widget`, `gtk.RecentAction`, `gtk.VolumeButton`, `gtk.MenuBar`, `gtk.TextView`, `gtk.Arrow`, `gtk.ToggleAction`, `gtk.RadioAction`, `gtk.Plug`, `gtk.HPaned`, `gtk.Box`, `gtk.Menu`, `gtk.Action`, `gtk.PrintUnixDialog`, `gtk.ComboBoxEntry`, `gtk.ColorButton`, `gtk.FileChooserDialog`, `gtk.Ruler`, `gtk.VPaned`, `gtk.HandleBox`, `gtk.Srollbar`, `gtk.Container`, `gtk.SizeGroup`, `gtk.ViewPort`, `gtk.ScrolledWindow`,

## Description

In order to allow construction from a GtkBuilder UI description, an object class must implement the GtkBuildable interface. The interface includes methods for setting names and properties of objects, parsing custom tags, constructing child objects.

The GtkBuildable interface is implemented by all widgets and many of the non-widget objects that are provided by GTK+. The main user of this interface is GtkBuilder, there should be very little need for applications to call any gtk.Buildable methods.

## Methods

### gtk.Buildable.add_child

        def add_child(builder, child, type)

`builder` : | A `gtk.Builder`
`child` : | The child to add.
`type` : | The kind of `child` or `None`.

### Note

This method is available in PyGTK 2.12 and above.

The `add_child`() method adds a child to buildable. type is an optional string describing how the child should be added.

### gtk.Buildable.construct_child

        def construct_child(builder, name)

`builder` : | A `gtk.Builder`
`name` : | The name of child to construct.
Returns : | The constructed child.

### Note

This method is available in PyGTK 2.12 and above.

The `construct_child`() method constructs a child of buildable with the name `name`.

GtkBuilder calls this function if a "constructor" has been specified in the UI definition.

### gtk.Buildable.get_internal_child

        def get_internal_child(builder, childname)

`builder` : | A `gtk.Builder`
`childname` : | The name of child.
Returns : | The internal child of the buildable object.

### Note

This method is available in PyGTK 2.12 and above.

The `get_internal_child`() method gets the internal child called childname of the buildable object.

### gtk.Buildable.get_name

        def get_name()

Returns : | The name set with `set_name`

### Note

This method is available in PyGTK 2.12 and above.

The `get_name`() method gets the name of the buildable object.

GtkBuilder sets the name based on the the GtkBuilder UI description used to construct the buildable.

### gtk.Buildable.parser_finished

        def parser_finished(builder)

`builder` : | A `gtk.Builder`

### Note

This method is available in PyGTK 2.12 and above.

The `parser_finished`() method is called when the builder finishes the parsing of a GtkBuilder UI definition. Note that this will be called once for each time `add_from_file` or `add_from_string` is called on a builder.

### gtk.Buildable.set_name

        def set_name(name)

`name` : | The name to set.

### Note

This method is available in PyGTK 2.12 and above.

The `set_name`() method sets the name of the buildable object.

Prev | Up | Next
gtk.Box | Home | gtk.Builder