gtk.ToolButton — a gtk.ToolItem
subclass that displays buttons (new in PyGTK 2.4)
class gtk.ToolButton(gtk.ToolItem): |
+--gobject.GObject +-- gtk.Object +-- gtk.Widget +-- gtk.Container +-- gtk.Bin +-- gtk.ToolItem +-- gtk.ToolButton
|
This widget is available in PyGTK 2.4 and above.
A gtk.ToolButton
is a sub class of gtk.ToolItem
that
contains a button. Use the gtk.ToolButton() constructor to
create a new gtk.ToolButton
specifying a widget to use as the icon and a label for the
text. Alternatively use the other gtk.ToolButton() constructor to
create a gtk.ToolButton
from a stock item.
The label of a gtk.ToolButton
is determined by the properties "label_widget", "label", and "stock_id". If
"label_widget" specifies a gtk.Widget
, that
widget is used as the label. If "label-widget" is None
,
then the string in "label" is used as the label. If both "label-widget" and
"label" are None
, the label is determined by the stock
item specified by "stock-id". Finally, if "label-widget", "label" and
"stock-id" are all None
, the button does not have a
label.
The icon of a gtk.ToolButton
is determined by the properties "icon-widget" and "stock-id". If
"icon-widget" specifies a gtk.Widget
, that
widget is used as the icon. If "icon-widget" is None
, the
icon is determined by the stock item specified by "stock-id". If both
"icon-widget" and "stock-id" are None
, the button does
not have an icon.
gtk.ToolButton(icon_widget
=None, label
=None)
| a gtk.Widget
that will be used as the icon widget, or
None |
| a string that will be used as the label, or
None |
Returns : | A new gtk.ToolButton |
This constructor is available in PyGTK 2.4 and above.
Creates a new gtk.ToolButton
optionally using the icon specified by icon_widget
and the label text specified by label
. If both
icon_widget
and label
are
None
, the tool button will be empty.
gtk.ToolButton(stock_id
)
| a string that specifies a stock item |
Returns : | A new gtk.ToolButton |
This constructor is available in PyGTK 2.4 and above.
Creates a new gtk.ToolButton
using the stock item specified by stock_id
to
determine the icon and label text. It is an error if
stock_id
is not a name of a stock item.
def set_label(label
)
| a string that will be used as 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
. If the "label_widget"
property is None
, label will be used as the label of the
tool button.
def get_label()
Returns : | The label, or
None |
This method is available in PyGTK 2.4 and above.
The get_label
() method returns the
value of the "label" property that is used as the label of the tool button
if the "label-widget" property is None
.
def set_use_underline(use_underline
)
| if True , an underline in the
label string specifies a mnemonic key for the overflow
menu |
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 "label" property indicates that the next character should
be used for the mnemonic accelerator key in the overflow menu. For example,
if the label property is "_Open" and use_underline
is
True
, the label on the tool button will be "Open" and the
item on the overflow menu will have an underlined 'O'. Labels shown on tool
buttons never have mnemonics on them; this property only affects the menu
item on the overflow menu.
def get_use_underline()
Returns : | True if underscores in the
"label" property are used as mnemonics on menu items on the
overflow menu. |
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
, underscores in the label property are used as
mnemonics on menu items on the overflow menu. See the set_use_underline()
method for more information.
def set_stock_id(stock_id
)
| a name of a stock item, or
None |
This method is available in PyGTK 2.4 and above.
The set_stock_id
() method sets the
"stock-id" property to the value of stock_id
. The
stock item specified by stock_id
is used to determine
the icon and label if not overridden by the "label" and "icon-widget"
properties. See the gtk.ToolButton() constructor for
more information.
def get_stock_id()
Returns : | the name of the stock item. |
This method is available in PyGTK 2.4 and above.
The get_stock_id
() method returns the
value of the "stock-id" property that contains the name of a stock item or
None
. See the gtk.ToolButton() constructor for
more information.
def set_icon_name(icon_name
)
| a name of a themed icon, or
None |
This method is available in PyGTK 2.8 and above.
The set_icon_name
() method sets the
"icon-name" property to the value of icon_name
. The
themed icon name specified by icon_name
is used to
determine the icon for the toolbutton if not overridden by the "label",
"stock-id" and "icon-widget" properties. See the gtk.ToolButton() constructor for
more information.
In PyGTK 2.10 and above, icon_name
may be
None
to unset the icon name.
def get_icon_name()
Returns : | the name of the stock item. |
This method is available in PyGTK 2.8 and above.
The get_icon_name
() method returns the
value of the "icon_name" property that contains the name of a themed icon or
None
. See the gtk.ToolButton() constructor for
more information.
def set_icon_widget(icon_widget
)
| the widget used as icon, or
None |
This method is available in PyGTK 2.4 and above.
The set_icon_widget
() method sets the
"icon-widget" property to the value of
icon_widget
. If icon_widget
specifies a gtk.Widget
, it is
used as the icon of the tool button. If icon_widget
is None
the icon is determined by the "stock_id"
property. If the "stock_id" property is also None
, the
tool button will not have an icon.
def get_icon_widget()
Returns : | The widget used as icon on
button , or
None . |
This method is available in PyGTK 2.4 and above.
The get_icon_widget
() method returns
the value of the "icon-widget" property that contains the gtk.Widget
used as
the icon on the tool button. See the set_icon_widget()
method for more information.
def set_label_widget(label_widget
)
| the widget used as the label, or
None |
This method is available in PyGTK 2.4 and above.
The set_label_widget
() method sets the
"label-widget" property to the gtk.Widget
specified
by label_widget
that will be used as the label for
the tool button. If label_widget
is
None
the "label" property is used as label. If
"label-widget" and "label" are both None
, the label in
the stock item determined by the "stock_id" property is used as the
label. If "label-widget", "label" and "stock_id" are all
None
, the tool button will not have a label.
def get_label_widget()
Returns : | The widget used as label on
button , or
None . |
This method is available in PyGTK 2.4 and above.
The get_label_widget
() method returns
the value of the "label-widget" property that is used as the label on the
tool button. See the gtk.ToolButton.set_label_widget()
method for more information.
def callback(toolbutton
, user_param1
, ...
)
| the toolbutton that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "clicked" signal is emitted when the tool button is clicked with the mouse or activated with the keyboard.