wx.aui.AuiToolBar¶
wx.aui.AuiToolBar is a dockable toolbar, part of the AUI
class framework.
See also AUI Overview.
The appearance of this class is configurable and can be changed by calling wx.aui.AuiToolBar.SetArtProvider
. By default, native art provider is used if available (currently only in wxMSW) and AuiGenericToolBarArt otherwise.
Window Styles¶
This class supports the following styles:
wx.aui.AUI_TB_TEXT
: Display the label strings on the toolbar buttons.wx.aui.AUI_TB_NO_TOOLTIPS
: Do not show tooltips for the toolbar items.wx.aui.AUI_TB_NO_AUTORESIZE
: Do not automatically resize the toolbar when new tools are added.wx.aui.AUI_TB_GRIPPER
: Show the toolbar’s gripper control. If the toolbar is added to anAUI
pane that contains a gripper, this style will be automatically set.wx.aui.AUI_TB_OVERFLOW
: Show an overflow menu containing toolbar items that can’t fit on the toolbar if it is too small.wx.aui.AUI_TB_VERTICAL
: Using this style forces the toolbar to be vertical and be only dockable to the left or right sides of the window whereas by default it can be horizontal or vertical and be docked anywhere.wx.aui.AUI_TB_HORZ_LAYOUT
:wx.aui.AUI_TB_HORIZONTAL
: Analogous towx.aui.AUI_TB_VERTICAL
, but forces the toolbar to be horizontal.wx.aui.AUI_TB_PLAIN_BACKGROUND
: Draw a plain background (based on parent) instead of the default gradient background.wx.aui.AUI_TB_HORZ_TEXT
: Equivalent towx.aui.AUI_TB_HORZ_LAYOUT
|wx.aui.AUI_TB_TEXT
wx.aui.AUI_TB_DEFAULT_STYLE
: The default is to have no styles.
Events Emitted by this Class¶
Handlers bound for the following event types will receive a wx.aui.AuiToolBarEvent parameter.
EVT_AUITOOLBAR_TOOL_DROPDOWN: Process a wxEVT_AUITOOLBAR_TOOL_DROPDOWN event
EVT_AUITOOLBAR_OVERFLOW_CLICK: Process a wxEVT_AUITOOLBAR_OVERFLOW_CLICK event
EVT_AUITOOLBAR_RIGHT_CLICK: Process a wxEVT_AUITOOLBAR_RIGHT_CLICK event
EVT_AUITOOLBAR_MIDDLE_CLICK: Process a wxEVT_AUITOOLBAR_MIDDLE_CLICK event
EVT_AUITOOLBAR_BEGIN_DRAG: Process a wxEVT_AUITOOLBAR_BEGIN_DRAG event
Class Hierarchy¶
Methods Summary¶
Default constructor, use |
|
Really create wx.aui.AuiToolBar created using default constructor. |
|
Removes the tool at the given position from the toolbar. |
|
Removes the tool with the given |
|
Destroys the tool with the given |
|
Destroys the tool at the given position and its associated window, if any. |
|
get size of hint rectangle for a particular dock location |
|
Returns whether the specified toolbar item has an associated drop down button. |
|
Gets the window style that was passed to the constructor or |
|
Add toolbar items that are always displayed in the overflow menu. |
|
Sets the font for this window. |
|
Set whether the specified toolbar item has a drop down button. |
|
Sets the style of the window. |
|
Properties Summary¶
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
Class API¶
- class wx.aui.AuiToolBar(Control)¶
Possible constructors:
AuiToolBar() -> None AuiToolBar(parent, id=ID_ANY, position=DefaultPosition, size=DefaultSize, style=AUI_TB_DEFAULT_STYLE) -> None
AuiToolBar is a dockable toolbar, part of the
AUI
class framework.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self)
Default constructor, use
Create
later.- Return type:
None
Added in version 2.9.5.
__init__ (self, parent, id=ID_ANY, position=DefaultPosition, size=DefaultSize, style=AUI_TB_DEFAULT_STYLE)
Constructor creating and initializing the object.
- Parameters:
- Return type:
None
- AddControl(self, control, label='')¶
- Parameters:
control (wx.Control)
label (string)
- Return type:
- AddLabel(self, toolId, label='', width=-1)¶
- Parameters:
toolId (int)
label (string)
width (int)
- Return type:
- AddSeparator(self)¶
- Return type:
- AddSpacer(self, pixels)¶
- Parameters:
pixels (int)
- Return type:
- AddStretchSpacer(self, proportion=1)¶
- Parameters:
proportion (int)
- Return type:
- AddTool(self, *args, **kw)¶
-
AddTool (self, toolId, label, bitmap, short_help_string=’’, kind=ITEM_NORMAL)
- Parameters:
toolId (int)
label (string)
bitmap (wx.BitmapBundle)
short_help_string (string)
kind (ItemKind)
- Return type:
AddTool (self, toolId, label, bitmap, disabled_bitmap, kind, short_help_string, long_help_string, client_data)
- Parameters:
toolId (int)
label (string)
bitmap (wx.BitmapBundle)
disabled_bitmap (wx.BitmapBundle)
kind (ItemKind)
short_help_string (string)
long_help_string (string)
client_data (wx.Object)
- Return type:
AddTool (self, toolId, bitmap, disabled_bitmap, toggle=False, client_data=None, short_help_string=’’, long_help_string=’’)
- Parameters:
toolId (int)
bitmap (wx.BitmapBundle)
disabled_bitmap (wx.BitmapBundle)
toggle (bool)
client_data (wx.Object)
short_help_string (string)
long_help_string (string)
- Return type:
- Clear(self)¶
- Return type:
None
- ClearTools(self)¶
- Return type:
None
- Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=AUI_TB_DEFAULT_STYLE)¶
Really create wx.aui.AuiToolBar created using default constructor.
- Parameters:
- Return type:
bool
Added in version 2.9.5.
- DeleteByIndex(self, idx)¶
Removes the tool at the given position from the toolbar.
Note that if this tool was added by
AddControl
, the associated control is not deleted and must either be reused (e.g. by reparenting it under a different window) or destroyed by caller. If this behaviour is unwanted, prefer usingDestroyToolByIndex
instead.- Parameters:
idx (int) – The index, or position, of a previously added tool.
- Return type:
bool
- Returns:
True
if the tool was removed orFalse
otherwise, e.g. if the provided index is out of range.
- DeleteTool(self, toolId)¶
Removes the tool with the given
ID
from the toolbar.Note that if this tool was added by
AddControl
, the associated control is not deleted and must either be reused (e.g. by reparenting it under a different window) or destroyed by caller. If this behaviour is unwanted, prefer usingDestroyTool
instead.- Parameters:
toolId (int) –
ID
of a previously added tool.- Return type:
bool
- Returns:
True
if the tool was removed orFalse
otherwise, e.g. if the tool with the givenID
was not found.
- DestroyTool(self, toolId)¶
Destroys the tool with the given
ID
and its associated window, if any.- Parameters:
toolId (int) –
ID
of a previously added tool.- Return type:
bool
- Returns:
True
if the tool was destroyed orFalse
otherwise, e.g. if the tool with the givenID
was not found.
Added in version 4.1/wxWidgets-3.1.4.
- DestroyToolByIndex(self, idx)¶
Destroys the tool at the given position and its associated window, if any.
- Parameters:
idx (int) – The index, or position, of a previously added tool.
- Return type:
bool
- Returns:
True
if the tool was destroyed orFalse
otherwise, e.g. if the provided index is out of range.
- EnableTool(self, toolId, state)¶
- Parameters:
toolId (int)
state (bool)
- Return type:
None
- FindControl(self, window_id)¶
- Parameters:
window_id (int)
- Return type:
Control
- FindTool(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
- FindToolByIndex(self, idx)¶
- Parameters:
idx (int)
- Return type:
- FindToolByPosition(self, x, y)¶
- Parameters:
x (int)
y (int)
- Return type:
- GetArtProvider(self)¶
- Return type:
- static GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)¶
- Parameters:
variant (WindowVariant)
- Return type:
VisualAttributes
- GetGripperVisible(self)¶
- Return type:
bool
- GetHintSize(self, dock_direction)¶
get size of hint rectangle for a particular dock location
- Parameters:
dock_direction (int)
- Return type:
Size
- GetOverflowVisible(self)¶
- Return type:
bool
- GetToolBarFits(self)¶
- Return type:
bool
- GetToolBitmap(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
Bitmap
- GetToolBitmapSize(self)¶
- Return type:
Size
- GetToolBorderPadding(self)¶
- Return type:
int
- GetToolCount(self)¶
- Return type:
int
- GetToolDropDown(self, toolId)¶
Returns whether the specified toolbar item has an associated drop down button.
- Parameters:
toolId (int)
- Return type:
bool
See also
- GetToolEnabled(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
bool
- GetToolFits(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
bool
- GetToolFitsByIndex(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
bool
- GetToolIndex(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
int
- GetToolLabel(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
str
- GetToolLongHelp(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
str
- GetToolPacking(self)¶
- Return type:
int
- GetToolPos(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
int
- GetToolProportion(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
int
- GetToolRect(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
Rect
- GetToolSeparation(self)¶
- Return type:
int
- GetToolShortHelp(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
str
- GetToolSticky(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
bool
- GetToolTextOrientation(self)¶
- Return type:
int
- GetToolToggled(self, toolId)¶
- Parameters:
toolId (int)
- Return type:
bool
- GetWindowStyleFlag(self)¶
Gets the window style that was passed to the constructor or
Create
method.GetWindowStyle
is another name for the same function.- Return type:
int
- IsPaneValid(self, pane)¶
- Parameters:
pane (wx.aui.AuiPaneInfo)
- Return type:
bool
- Realize(self)¶
- Return type:
bool
- SetArtProvider(self, art)¶
- Parameters:
art (wx.aui.AuiToolBarArt)
- Return type:
None
- SetCustomOverflowItems(self, prepend, append)¶
Add toolbar items that are always displayed in the overflow menu.
If there are custom items set, then the overflow menu will be displayed even if there are no items from the main toolbar that overflow.
- Parameters:
prepend (AuiToolBarItemArray) – are the items to show before any overflow items
append (AuiToolBarItemArray) – are the items to show after any overflow items
- Return type:
None
Note
The toolbar must have the
AUI_TB_OVERFLOW
style.
- SetFont(self, font)¶
Sets the font for this window.
This function should not be called for the parent window if you don’t want its font to be inherited by its children, use
SetOwnFont
instead in this case and seeInheritAttributes
for more explanations.Please notice that the given font is not automatically used for wx.PaintDC objects associated with this window, you need to call
wx.DC.SetFont
too. However this font is used by any standard controls for drawing their text as well as byGetTextExtent
.- Parameters:
font (wx.Font) – Font to associate with this window, pass NullFont to reset to the default font.
- Return type:
bool
- Returns:
True
if the font was really changed,False
if it was already set to this font and nothing was done.
See also
GetFont
,InheritAttributes
- SetGripperVisible(self, visible)¶
- Parameters:
visible (bool)
- Return type:
None
- SetMargins(self, *args, **kw)¶
-
SetMargins (self, size)
- Parameters:
size (wx.Size)
- Return type:
None
SetMargins (self, x, y)
- Parameters:
x (int)
y (int)
- Return type:
None
SetMargins (self, left, right, top, bottom)
- Parameters:
left (int)
right (int)
top (int)
bottom (int)
- Return type:
None
- SetOverflowVisible(self, visible)¶
- Parameters:
visible (bool)
- Return type:
None
- SetToolBitmap(self, toolId, bitmap)¶
- Parameters:
toolId (int)
bitmap (wx.BitmapBundle)
- Return type:
None
- SetToolBorderPadding(self, padding)¶
- Parameters:
padding (int)
- Return type:
None
- SetToolDropDown(self, toolId, dropdown)¶
Set whether the specified toolbar item has a drop down button.
This is only valid for
wx.ITEM_NORMAL
tools.- Parameters:
toolId (int)
dropdown (bool)
- Return type:
None
See also
- SetToolLabel(self, toolId, label)¶
- Parameters:
toolId (int)
label (string)
- Return type:
None
- SetToolLongHelp(self, toolId, help_string)¶
- Parameters:
toolId (int)
help_string (string)
- Return type:
None
- SetToolPacking(self, packing)¶
- Parameters:
packing (int)
- Return type:
None
- SetToolProportion(self, toolId, proportion)¶
- Parameters:
toolId (int)
proportion (int)
- Return type:
None
- SetToolSeparation(self, separation)¶
- Parameters:
separation (int)
- Return type:
None
- SetToolShortHelp(self, toolId, help_string)¶
- Parameters:
toolId (int)
help_string (string)
- Return type:
None
- SetToolSticky(self, toolId, sticky)¶
- Parameters:
toolId (int)
sticky (bool)
- Return type:
None
- SetToolTextOrientation(self, orientation)¶
- Parameters:
orientation (int)
- Return type:
None
- SetWindowStyleFlag(self, style)¶
Sets the style of the window.
Please note that some styles cannot be changed after the window creation and that
Refresh
might need to be called after changing the others for the change to take place immediately.See Window styles for more information about flags.
- Parameters:
style (long)
- Return type:
None
See also
- ToggleTool(self, toolId, state)¶
- Parameters:
toolId (int)
state (bool)
- Return type:
None
Properties¶
- ArtProvider¶
See
GetArtProvider
andSetArtProvider
- GripperVisible¶
See
GetGripperVisible
andSetGripperVisible
- OverflowVisible¶
See
GetOverflowVisible
andSetOverflowVisible
- ToolBarFits¶
See
GetToolBarFits
- ToolBitmapSize¶
See
GetToolBitmapSize
andSetToolBitmapSize
- ToolBorderPadding¶
- ToolCount¶
See
GetToolCount
- ToolPacking¶
See
GetToolPacking
andSetToolPacking
- ToolSeparation¶
See
GetToolSeparation
andSetToolSeparation
- ToolTextOrientation¶
- WindowStyleFlag¶
See
GetWindowStyleFlag
andSetWindowStyleFlag