Buildable#

class Buildable(*args, **kwargs)#

Implementations: AboutDialog, ActionBar, AnyFilter, AppChooserButton, AppChooserDialog, AppChooserWidget, ApplicationWindow, AspectFrame, Assistant, Box, Button, Calendar, CellArea, CellAreaBox, CellView, CenterBox, CheckButton, ColorButton, ColorChooserDialog, ColorChooserWidget, ColorDialogButton, ColumnView, ComboBox, ComboBoxText, ConstraintLayout, Dialog, DragIcon, DrawingArea, DropDown, EditableLabel, EmojiChooser, Entry, EntryCompletion, EveryFilter, Expander, FileChooserDialog, FileChooserWidget, FileFilter, Fixed, FlowBox, FlowBoxChild, FontButton, FontChooserDialog, FontChooserWidget, FontDialogButton, Frame, GLArea, GraphicsOffload, Grid, GridView, HeaderBar, IconView, Image, InfoBar, Inscription, Label, LevelBar, LinkButton, ListBase, ListBox, ListBoxRow, ListStore, ListView, LockButton, MediaControls, MenuButton, MessageDialog, MultiFilter, MultiSorter, Notebook, Overlay, PageSetupUnixDialog, Paned, PasswordEntry, Picture, Popover, PopoverBin, PopoverMenu, PopoverMenuBar, PrintUnixDialog, ProgressBar, Range, Revealer, Scale, ScaleButton, Scrollbar, ScrolledWindow, SearchBar, SearchEntry, Separator, ShortcutController, ShortcutLabel, ShortcutsGroup, ShortcutsSection, ShortcutsShortcut, ShortcutsWindow, SizeGroup, SpinButton, Spinner, Stack, StackSidebar, StackSwitcher, Statusbar, StringList, Switch, Text, TextTagTable, TextView, ToggleButton, TreeExpander, TreeStore, TreeView, TreeViewColumn, Video, Viewport, VolumeButton, Widget, Window, WindowControls, WindowHandle

Allows objects to extend and customize deserialization from ui files.

The GtkBuildable interface includes methods for setting names and properties of objects, parsing custom tags and constructing child objects.

It is implemented by all widgets and many of the non-widget objects that are provided by GTK. The main user of this interface is Builder. There should be very little need for applications to call any of these functions directly.

An object only needs to implement this interface if it needs to extend the GtkBuilder XML format or run any extra routines at deserialization time.

Methods#

class Buildable
get_buildable_id() str | None#

Gets the ID of the buildable object.

GtkBuilder sets the name based on the ID attribute of the <object> tag used to construct the buildable.

Virtual Methods#

class Buildable
do_add_child(builder: Builder, child: Object, type: str | None = None) None#

Adds a child to buildable. type is an optional string describing how the child should be added.

Parameters:
  • builder – a GtkBuilder

  • child – child to add

  • type – kind of child or None

do_custom_finished(builder: Builder, child: Object | None, tagname: str, data: Any = None) None#

Similar to gtk_buildable_parser_finished() but is called once for each custom tag handled by the buildable.

Parameters:
  • builder – a GtkBuilder

  • child – child object or None for non-child tags

  • tagname – the name of the tag

  • data – user data created in custom_tag_start

do_custom_tag_end(builder: Builder, child: Object | None, tagname: str, data: Any = None) None#

Called at the end of each custom element handled by the buildable.

Parameters:
  • builderGtkBuilder used to construct this object

  • child – child object or None for non-child tags

  • tagname – name of tag

  • data – user data that will be passed in to parser functions

do_custom_tag_start(builder: Builder, child: Object | None, tagname: str) tuple[bool, BuildableParser, Any | None]#

Called for each unknown element under <child>.

Parameters:
  • builder – a GtkBuilder used to construct this object

  • child – child object or None for non-child tags

  • tagname – name of tag

do_get_id() str#

The getter corresponding to set_id. Implement this if you implement set_id.

do_get_internal_child(builder: Builder, childname: str) Object#

Retrieves the internal child called childname of the buildable object.

Parameters:
  • builder – a GtkBuilder

  • childname – name of child

do_parser_finished(builder: Builder) None#

Called when a builder finishes the parsing of a UI definition. It is normally not necessary to implement this, unless you need to perform special cleanup actions. GtkWindow sets the GtkWidget:visible property here.

Parameters:

builder

do_set_buildable_property(builder: Builder, name: str, value: Value) None#

Sets a property of a buildable object. It is normally not necessary to implement this, set_property() is used by default. GtkWindow implements this to delay showing itself (i.e. setting the visible property) until the whole interface is created.

Parameters:
  • builder

  • name

  • value

do_set_id(id: str) None#

Stores the id attribute given in the GtkBuilder UI definition. GtkWidget stores the name as object data. Implement this method if your object has some notion of “ID” and it makes sense to map the XML id attribute to it.

Parameters:

id