Expander
Superclasses: Widget
, InitiallyUnowned
, Object
Implemented Interfaces: Accessible
, Buildable
, ConstraintTarget
- Constructors:
Expander(**properties)
new(label:str=None) -> Gtk.Widget
new_with_mnemonic(label:str=None) -> Gtk.Widget
Constructors
- class Expander
- classmethod new(label: str | None = None) Widget
Creates a new expander using
label
as the text of the label.- Parameters:
label – the text of the label
- classmethod new_with_mnemonic(label: str | None = None) Widget
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.
- Parameters:
label – the text of the label with an underscore in front of the mnemonic character
Methods
- class Expander
-
- get_expanded() bool
Queries a
GtkExpander
and returns its current state.Returns
True
if the child widget is revealed.
- get_label() str | None
Fetches the text from a label widget.
This is including any embedded underlines indicating mnemonics and Pango markup, as set by
set_label
. If the label text has not been set the return value will beNone
. This will be the case if you create an empty button withnew()
to use as a container.
- get_resize_toplevel() bool
Returns whether the expander will resize the toplevel widget containing the expander upon resizing and collapsing.
- set_child(child: Widget | None = None) None
Sets the child widget of
expander
.- Parameters:
child – the child widget
- set_expanded(expanded: bool) None
Sets the state of the expander.
Set to
True
, if you want the child widget to be revealed, andFalse
if you want the child widget to be hidden.- Parameters:
expanded – whether the child widget is revealed
- set_label(label: str | None = None) None
Sets the text of the label of the expander to
label
.This will also clear any previously set labels.
- Parameters:
label – a string
- set_label_widget(label_widget: Widget | None = None) None
Set the label widget for the expander.
This is the widget that will appear embedded alongside the expander arrow.
- Parameters:
label_widget – the new label widget
- set_resize_toplevel(resize_toplevel: bool) None
Sets whether the expander will resize the toplevel widget containing the expander upon resizing and collapsing.
- Parameters:
resize_toplevel – whether to resize the toplevel