Basics
Guides
API Reference
Basics
Guides
API Reference
[569:14] static extends: object
Generated metadata helpers for Expander class surfaces.
properties ()
Returns property metadata for
Expander.
A list.signals ()
Returns signal metadata for
Expander.
A list.[42:7] extends: object
Allows the user to reveal or conceal a child widget.
GtkTreeView. Normally you use an expander as you would
use a frame; you create the child widget and use
[method@Gtk.Expander.set_child] to add it to the expander. When the expander
is toggled, it will take care of showing and hiding the child automatically.
the expanded widget yourself, such as when you want to actually create the
widget at expansion time. In this case, create a GtkExpander but do not add
a child to it. The expander widget has an [property@Gtk.Expander:expanded]
property which can be used to monitor its expansion state. You should watch
this property with a signal connection as follows: c static void expander_callback (GObject *object, GParamSpec *param_spec, gpointer user_data) { GtkExpander *expander; expander = GTK_EXPANDER (object); if (gtk_expander_get_expanded (expander)) { // Show or create widgets } else { // Hide or destroy widgets } } static void create_expander (void) { GtkWidget *expander = gtk_expander_new_with_mnemonic ("_More Options"); g_signal_connect (expander, "notify::expanded", G_CALLBACK (expander_callback), NULL); // ... } # GtkExpander as GtkBuildable An
example of a UI definition fragment with GtkExpander: xml <object class="GtkExpander"> <property name="label-widget"> <object class="GtkLabel" id="expander-label"/> </property> <property name="child"> <object class="GtkEntry" id="expander-content"/> </property> </object> # CSS
nodes expander-widget ╰── box ├── title │ ├── expander │ ╰── <label widget> ╰── <child> GtkExpander 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 GtkExpander uses the
[enum@Gtk.AccessibleRole.button] role.
Expander (label = null)
Creates a new expander using @label as the text of the label.
label is the text of the label.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asWidget ()
Wraps this handle as
Widget.
A Widget object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asConstraintTarget ()
Wraps this handle as
ConstraintTarget.
A ConstraintTarget object.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnActivate (callback Fn, UserData = null)
Activates the
GtkExpander.
Fn is the Aussom callback.Fn is called with (Expander Self).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setChild (object Value)
The child widget.
Value is the new property value.None.setExpanded (bool Value)
Whether the expander has been opened to reveal the child.
Value is the new property value.None.setLabel (string Value)
The text of the expanders label.
Value is the new property value.None.setLabelwidget (object Value)
A widget to display instead of the usual expander label.
Value is the new property value.None.setResizetoplevel (bool Value)
When this property is %TRUE, the expander will resize the toplevel widget containing the expander upon expanding and collapsing.
Value is the new property value.None.setUsemarkup (bool Value)
Whether the text in the label is Pango markup.
Value is the new property value.None.setUseunderline (bool Value)
Whether an underline in the text indicates a mnemonic.
Value is the new property value.None.get_child ()
Gets the child widget of @expander.
get_expanded ()
Queries a
GtkExpanderand returns its current state. Returns %TRUE if the child widget is revealed.
get_label ()
Fetches the text from a label widget. This is including any embedded underlines indicating mnemonics and Pango markup, as set by [method@Gtk.Expander.set_label]. If the label text has not been set the return value will be %NULL. This will be the case if you create an empty button with gtk_button_new() to use as a container.
get_label_widget ()
Retrieves the label widget for the frame.
get_resize_toplevel ()
Returns whether the expander will resize the toplevel widget containing the expander upon resizing and collapsing.
get_use_markup ()
Returns whether the label’s text is interpreted as Pango markup.
get_use_underline ()
Returns whether an underline in the text indicates a mnemonic.
set_child (object child)
Sets the child widget of @expander.
child is the child widget.None.set_expanded (bool expanded)
Sets the state of the expander. Set to %TRUE, if you want the child widget to be revealed, and %FALSE if you want the child widget to be hidden.
expanded is whether the child widget is revealed.None.set_label (string label)
Sets the text of the label of the expander to @label. This will also clear any previously set labels.
label is a string.None.set_label_widget (object label_widget)
Set the label widget for the expander. This is the widget that will appear embedded alongside the expander arrow.
label_widget is the new label widget.None.set_resize_toplevel (bool resize_toplevel)
Sets whether the expander will resize the toplevel widget containing the expander upon resizing and collapsing.
resize_toplevel is whether to resize the toplevel.None.set_use_markup (bool use_markup)
Sets whether the text of the label contains Pango markup.
use_markup is %TRUE if the label’s text should be parsed for markup.None.set_use_underline (bool use_underline)
If true, an underline in the text indicates a mnemonic.
use_underline is %TRUE if underlines in the text indicate mnemonics.None.[474:14] static extends: object
Alternate constructors for Expander. Usage:
ExpanderCtors.<name>(...). The primary constructor lives
directly on Expander.
newWithMnemonic (string label)
Creates a new expander using @label as the text of the label. If characters in @label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use “__” (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the button.
label is the text of the label with an underscore in front of the mnemonic character.A new Expander.[499:7] extends: object
Generated low-level callback wrapper for GIR callback activate.
ExpanderActivateCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.

Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.