Basics
Guides
API Reference
Basics
Guides
API Reference
[408:14] static extends: object
Generated metadata helpers for ToggleButton class surfaces.
properties ()
Returns property metadata for
ToggleButton.
A list.signals ()
Returns signal metadata for
ToggleButton.
A list.[43:7] extends: object
Shows a button which remains “pressed-in” when clicked.
GtkLabel and/or a GtkImage), into the toggle
button’s container. (See [class@Gtk.Button] for more information). The state
of a GtkToggleButton can be set specifically using
[method@Gtk.ToggleButton.set_active], and retrieved using
[method@Gtk.ToggleButton.get_active]. ## Grouping Toggle buttons can be
grouped together, to form mutually exclusive groups - only one of the buttons
can be toggled at a time, and toggling another one will switch the currently
toggled one off. To add a GtkToggleButton to a group, use
[method@Gtk.ToggleButton.set_group]. ## CSS nodes GtkToggleButton has a
single CSS node with name button. To differentiate it from a plain
GtkButton, it gets the .toggle style class. ## Accessibility
GtkToggleButton uses the [enum@Gtk.AccessibleRole.toggle_button] role. ##
Creating two GtkToggleButton widgets. c static void output_state (GtkToggleButton *source, gpointer user_data) { g_print ("Toggle button "%s" is active: %s", gtk_button_get_label (GTK_BUTTON (source)), gtk_toggle_button_get_active (source) ? "Yes" : "No"); } static void make_toggles (void) { GtkWidget *window, *toggle1, *toggle2; GtkWidget *box; const char *text; window = gtk_window_new (); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); text = "Hi, I’m toggle button one"; toggle1 = gtk_toggle_button_new_with_label (text); g_signal_connect (toggle1, "toggled", G_CALLBACK (output_state), NULL); gtk_box_append (GTK_BOX (box), toggle1); text = "Hi, I’m toggle button two"; toggle2 = gtk_toggle_button_new_with_label (text); g_signal_connect (toggle2, "toggled", G_CALLBACK (output_state), NULL); gtk_box_append (GTK_BOX (box), toggle2); gtk_window_set_child (GTK_WINDOW (window), box); gtk_window_present (GTK_WINDOW (window)); }
ToggleButton (label = null)
Creates a new toggle button. A widget should be packed into the button, as in [ctor@Gtk.Button.new].
label is a string containing the message to be placed in the toggle button..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.asButton ()
Wraps this handle as
Button.
A Button object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asActionable ()
Wraps this handle as
Actionable.
A Actionable 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.setOnToggled (callback Fn, UserData = null)
Emitted whenever the
GtkToggleButton's state is changed.
Fn is the Aussom callback.Fn is called with (ToggleButton 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.
setActive (bool Value)
If the toggle button should be pressed in.
Value is the new property value.None.setGroup (object Value)
The toggle button whose group this widget belongs to.
Value is the new property value.None.get_active ()
Queries a
GtkToggleButtonand returns its current state. Returns %TRUE if the toggle button is pressed in and %FALSE if it is raised.
set_active (bool is_active)
Sets the status of the toggle button. Set to %TRUE if you want the
GtkToggleButtonto be “pressed in”, and %FALSE to raise it. If the status of the button changes, this action causes the [signal@Gtk.ToggleButton::toggled] signal to be emitted.
is_active is %TRUE or %FALSE..None.set_group (object group)
Adds @self to the group of @group. In a group of multiple toggle buttons, only one button can be active at a time. Setting up groups in a cycle leads to undefined behavior. Note that the same effect can be achieved via the [iface@Gtk.Actionable] API, by using the same action with parameter type and state type 's' for all buttons in the group, and giving each button its own target value.
group is another GtkToggleButton to form a group with.None.toggled ()
Emits the ::toggled signal on the
GtkToggleButton.
None.[316:14] static extends: object
Alternate constructors for ToggleButton. Usage:
ToggleButtonCtors.<name>(...). The primary constructor lives
directly on ToggleButton.
newWithMnemonic (string label)
Creates a new
GtkToggleButtoncontaining a label. The label will be created using [ctor@Gtk.Label.new_with_mnemonic], so underscores in
indicate the mnemonic for the button.label is the text of the button, with an underscore in front of the mnemonic character.A new ToggleButton.[338:7] extends: object
Generated low-level callback wrapper for GIR callback toggled.
ToggleButtonToggledCallback (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.