wx.lib.agw.flatmenu.FlatToolbarItem¶
This class represents a toolbar item.
Class Hierarchy¶
Methods Summary¶
Default class constructor. |
|
Enables or disables the tool. |
|
Returns the tool bitmap. |
|
Returns the associated custom control. |
|
Returns the tool disabled bitmap. |
|
Returns group id for radio item, or -1 for other item types. |
|
Gets the tool id. |
|
Returns the tool label. |
|
Returns the tool long help string (displayed in the parent frame |
|
Returns the tool short help string (displayed in the tool’s tooltip). |
|
Same as |
|
Returns |
|
Returns whether the tool is a custom control or not. |
|
Returns whether the tool is enabled or not. |
|
Returns |
|
Returns whether the tool is a standard tool or not. |
|
Returns whether the tool is selected or checked. |
|
Returns whether the tool is a separator or not. |
|
Selects or checks a radio or check item. |
|
Sets the tool bitmap. |
|
Sets the tool disabled bitmap. |
|
Sets group id for a radio item, for other items does nothing. |
|
Sets the tool label. |
|
Sets the tool long help string (displayed in the parent frame |
|
Sets the tool short help string (displayed in the tool’s tooltip). |
|
Toggles a check item. |
Class API¶
- class FlatToolbarItem(object)¶
This class represents a toolbar item.
Methods¶
- __init__(self, controlType=None, id=wx.ID_ANY, label='', disabledBmp=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp='', longHelp='')¶
Default class constructor.
- Parameters:
controlType – can be
None
for a toolbar separator, an instance ofwx.Window
for a control or an instance ofwx.Bitmap
for a standard toolbar tool;id (integer) – the toolbar tool id. If set to
wx.ID_ANY
, a new id is automatically assigned;label (string) – the toolbar tool label;
disabledBmp – the bitmap used when the tool is disabled. If the tool is a standard one (i.e., not a control or a separator), and disabledBmp is equal to
NullBitmap
, the disabled bitmap is automatically generated by greing the normal one;kind (integer) – may be
wx.ITEM_NORMAL
for a normal button (default),wx.ITEM_CHECK
for a checkable tool (such tool stays pressed after it had been toggled) orwx.ITEM_RADIO
for a checkable tool which makes part of a radio group of tools each of which is automatically unchecked whenever another button in the group is checked;shortHelp (string) – a string used for the tool’s tooltip;
longHelp (string) – this string is shown in the
StatusBar
(if any) of the parent frame when the mouse pointer is inside the tool.
- Enable(self, enable=True)¶
Enables or disables the tool.
- Parameters:
enable (bool) –
True
to enable the tool,False
to disable it.
- GetBitmap(self)¶
Returns the tool bitmap.
- GetCustomControl(self)¶
Returns the associated custom control.
- GetDisabledBitmap(self)¶
Returns the tool disabled bitmap.
- GetGroup(self)¶
Returns group id for radio item, or -1 for other item types.
- GetId(self)¶
Gets the tool id.
- GetLabel(self)¶
Returns the tool label.
- GetLongHelp(self)¶
Returns the tool long help string (displayed in the parent frame
StatusBar
).
- GetShortHelp(self)¶
Returns the tool short help string (displayed in the tool’s tooltip).
- IsChecked(self)¶
Same as
IsSelected
. More intuitive for check items though.
- IsCheckItem(self)¶
Returns
True
if the item is a radio item.
- IsCustomControl(self)¶
Returns whether the tool is a custom control or not.
- IsEnabled(self)¶
Returns whether the tool is enabled or not.
- IsRadioItem(self)¶
Returns
True
if the item is a radio item.
- IsRegularItem(self)¶
Returns whether the tool is a standard tool or not.
- IsSelected(self)¶
Returns whether the tool is selected or checked.
- IsSeparator(self)¶
Returns whether the tool is a separator or not.
- Select(self, select=True)¶
Selects or checks a radio or check item.
- Parameters:
select (bool) –
True
to select or check a tool,False
to unselect or uncheck it.
- SetBitmap(self, bmp)¶
Sets the tool bitmap.
- Parameters:
bmp – the new tool bitmap, a valid
wx.Bitmap
object.
- SetDisabledBitmap(self, bmp)¶
Sets the tool disabled bitmap.
- Parameters:
bmp – the new tool disabled bitmap, a valid
wx.Bitmap
object.
- SetGroup(self, group)¶
Sets group id for a radio item, for other items does nothing.
- Parameters:
group – an instance of
FlatMenuItemGroup
.
- SetLabel(self, label)¶
Sets the tool label.
- Parameters:
label (string) – the new tool string.
- SetLongHelp(self, help)¶
Sets the tool long help string (displayed in the parent frame
StatusBar
).- Parameters:
help (string) – the new tool long help string.
- SetShortHelp(self, help)¶
Sets the tool short help string (displayed in the tool’s tooltip).
- Parameters:
help (string) – the new tool short help string.
- Toggle(self)¶
Toggles a check item.