Normally you use an expander as you would use a frame; you create
the child widget and use gtk.expander.Expander.setChild to add it
to the expander. When the expander is toggled, it will take care of
showing and hiding the child automatically.
Special Usage
There are situations in which you may prefer to show and hide the
expanded widget yourself, such as when you want to actually create
the widget at expansion time. In this case, create a gtk.expander.Expander
but do not add a child to it. The expander widget has an
gtk.expander.Expander.gboolean property which can be used to
monitor its expansion state. You should watch this property with
a signal connection as follows:
The gtk.expander.Expander implementation of the gtk.buildable.Buildable interface supports
placing a child in the label position by specifying “label” as the
“type” attribute of a <child> element. A normal content child can be
specified without specifying a <child> type attribute.
An example of a UI definition fragment with GtkExpander:
gtk.expander.Expander has a main node expander-widget, and subnode box containing
the title and child widget. The box subnode title contains node expander,
i.e. the expand/collapse arrow; then the label widget if any. The arrow of an
expander that is showing its child gets the :checked pseudoclass set on it.
gtk.expander.Expander allows the user to reveal its child by clicking on an expander triangle.
This is similar to the triangles used in a gtk.tree_view.TreeView.
Normally you use an expander as you would use a frame; you create the child widget and use gtk.expander.Expander.setChild to add it to the expander. When the expander is toggled, it will take care of showing and hiding the child automatically.
Special Usage
There are situations in which you may prefer to show and hide the expanded widget yourself, such as when you want to actually create the widget at expansion time. In this case, create a gtk.expander.Expander but do not add a child to it. The expander widget has an gtk.expander.Expander.gboolean property which can be used to monitor its expansion state. You should watch this property with a signal connection as follows:
GtkExpander as GtkBuildable
The gtk.expander.Expander implementation of the gtk.buildable.Buildable interface supports placing a child in the label position by specifying “label” as the “type” attribute of a <child> element. A normal content child can be specified without specifying a <child> type attribute.
An example of a UI definition fragment with GtkExpander:
CSS nodes
gtk.expander.Expander has a main node expander-widget, and subnode box containing the title and child widget. The box subnode title contains node expander, i.e. the expand/collapse arrow; then the label widget if any. The arrow of an expander that is showing its child gets the :checked pseudoclass set on it.
Accessibility
gtk.expander.Expander uses the gtk.types.AccessibleRole.Button role.