gtk.Expander — a container that can hide its child (new in PyGTK 2.4)
class gtk.Expander(gtk.Bin): |
Functions
|
+-- gobject.GObject +-- gtk.Object +-- gtk.Widget +-- gtk.Container +-- gtk.Bin +-- gtk.Expander |
|
gobject.GObject Signal Prototypes
gtk.Container Signal Prototypes
"activate" | def callback(expander, user_param1, ...) |
This widget is available in PyGTK 2.4 and above.
A gtk.Expander allows the user to hide or show its child by clicking on an expander triangle similar to the triangles used in a gtk.TreeView.
Normally you use an expander as you would use any other descendant of gtk.Bin; you create the child widget and use gtk.Container.add() to add it to the expander. When the expander is toggled, it will take care of showing and hiding the child automatically.
There 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 but do not add a child to it. The expander widget has the "expanded" property that can be used to monitor its expansion state. You should watch this property with a signal connection as follows:
expander = gtk.expander_new_with_mnemonic("_More Options") expander.connect("notify::expanded", expander_callback) ... def expander_callback(expander, param_spec, user_data): if expander.get_expanded(): # Show or create widgets else: # Hide or destroy widgets |
The "activate" signal can also be used to track the expansion though it occurs before the "expanded" property is changed so the logic of the expander_callback() function would have to be reversed.
|
label : | the text of the label or None |
Returns : | a new gtk.Expander widget. |
This constructor is available in PyGTK 2.4 and above.
Creates a new expander using label as the text of the label. If label is None or not specified, no label will be created.
|
expanded : | if TRUE, the child widget is revealed |
This method is available in PyGTK 2.4 and above.
The set_expanded() method sets the "expanded" property to the value of expanded. If expanded is TRUE, the child widget is revealed; if FALSE, the child widget is hidden.
|
Returns : | TRUE if the child is revealed. |
This method is available in PyGTK 2.4 and above.
The get_expanded() method returns the value of the "expanded" property. If "expanded" is TRUE the child widget is revealed.
|
spacing : | the distance between the expander and child in pixels. |
This method is available in PyGTK 2.4 and above.
The set_spacing() method sets the "spacing" property to the value of spacing that sets is the number of pixels to place between expander and the child.
|
Returns : | the spacing between the expander and child. |
This method is available in PyGTK 2.4 and above.
The get_spacing() method returns the value of the "spacing" property set by the set_spacing() method.
|
label : | a string to use as the label or None |
This method is available in PyGTK 2.4 and above.
The set_label() method sets the "label" property to the value of label and sets the text of the label of the expander. Any previously set label will be cleared. If label is None the expander will have no label.
|
Returns : | the text of the label widget. |
This method is available in PyGTK 2.4 and above.
The get_label() method returns the value of the "label" property that contains the text of the expander label, as set by the set_label() method. If the label text has not been set the return value will be None.
|
use_underline : | TRUE if underlines in the text indicate mnemonics |
This method is available in PyGTK 2.4 and above.
The set_use_underline() method sets the "use_underline" property to the value of use_underline. If use_underline is TRUE, an underline in the text of the expander label indicates the next character should be used for the mnemonic accelerator key.
|
Returns : | TRUE if an embedded underline in the expander label indicates the mnemonic accelerator keys. |
This method is available in PyGTK 2.4 and above.
The get_use_underline() method returns the value of the "use-underline" property. If "use-underline" is TRUE an embedded underline in the expander label indicates a mnemonic. See the set_use_underline() method.
|
use_markup : | if TRUE, the label's text should be parsed for markup |
This method is available in PyGTK 2.4 and above.
The set_use_markup() method sets the "use-markup" property to the value of use_markup. If use_markup is TRUE the text of the label contains markup in the Pango text markup language. See the gtk.Label.set_markup() method for more information.
|
Returns : | TRUE if the label's text will be parsed for markup |
This method is available in PyGTK 2.4 and above.
The get_use_markup() method returns the value of the "use-markup" property. If "use-markup" is TRUE, the label's text is interpreted as marked up with the Pango text markup language. See the set_use_markup() method.
|
label_widget : | the new label widget or None |
This method is available in PyGTK 2.4 and above.
The set_label_widget() method sets the expander to use the widget specified by label_widget as the label instead of a gtk.Label. This widget appears embedded alongside the expander arrow. If label_widget is None, the expander will have no label.
|
Returns : | the label widget, or None if there is none. |
This method is available in PyGTK 2.4 and above.
The get_label_widget() method retrieves the expander's label widget. See the set_label_widget() method.
|
label : | the text of the label with an underscore in front of the mnemonic character or None |
Returns : | a new gtk.Expander widget. |
This function is available in PyGTK 2.4 and above.
The gtk.expander_new_with_mnemonic() function creates a new gtk.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 with that key activates the button. If label is None the expander will have no label.
|
expander : | the expander that received the signal |
user_param1 : | the first user parameter (if any) specified with the connect() method |
... : | additional user parameters (if any) |
This signal is available in PyGTK 2.4 and above.
The "activate" signal is emitted when the expander is activated by the user clicking on the expander toggle.