phoenix_title wx.lib.agw.aui.auibar.AuiToolBar

AuiToolBar is a completely owner-drawn toolbar perfectly integrated with the AUI layout system. This allows drag and drop of toolbars, docking/floating behaviour and the possibility to define “overflow” items in the toolbar itself.

The default theme that is used is AuiDefaultToolBarArt, which provides a modern, glossy look and feel. The theme can be changed by calling AuiToolBar.SetArtProvider.


class_hierarchy Class Hierarchy

Inheritance diagram for class AuiToolBar:

appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


super_classes Known Superclasses

wx.Control


method_summary Methods Summary

__init__

Default class constructor.

AddCheckTool

Adds a new check (or toggle) tool to the AuiToolBar.

AddControl

Adds any control to the toolbar, typically e.g. a ComboBox.

AddLabel

Adds a label tool to the AuiToolBar.

AddRadioTool

Adds a new radio tool to the toolbar.

AddSeparator

Adds a separator for spacing groups of tools.

AddSimpleTool

Adds a tool to the toolbar. This is the simplest method you can use to

AddSpacer

Adds a spacer for spacing groups of tools.

AddStretchSpacer

Adds a stretchable spacer for spacing groups of tools.

AddToggleTool

Adds a toggle tool to the toolbar.

AddTool

Adds a tool to the toolbar. This is the full feature version of AddTool.

Clear

Deletes all the tools in the AuiToolBar.

ClearTools

Deletes all the tools in the AuiToolBar.

DeleteTool

Removes the specified tool from the toolbar and deletes it.

DeleteToolByPos

This function behaves like DeleteTool but it deletes the tool at the specified position and not the one with the given id.

DoGetBestSize

Gets the size which best suits the window: for a control, it would be the

DoIdleUpdate

Updates the toolbar during idle times.

DoSetSize

Sets the position and size of the window in pixels. The sizeFlags

EnableTool

Enables or disables the tool.

FindControl

Returns a pointer to the control identified by id or None if no corresponding control is found.

FindTool

Finds a tool for the given tool id.

FindToolByIndex

Finds a tool for the given tool position in the AuiToolBar.

FindToolByLabel

Finds a tool for the given label.

FindToolByUserData

Finds a tool for the given client id.

FindToolForPosition

Finds a tool for the given mouse position.

FindToolForPositionWithPacking

Finds a tool for the given mouse position, taking into account also the tool packing.

GetAGWWindowStyleFlag

Returns the AGW-specific window style flag.

GetArtProvider

Returns the current art provider being used.

GetAuiManager

Returns the AuiManager which manages the toolbar.

GetGripperVisible

Returns whether the toolbar gripper is visible or not.

GetLabelSize

Returns the standard size of a toolbar item.

GetOverflowRect

Returns the rectangle of the overflow button.

GetOverflowState

Returns the state of the overflow button.

GetOverflowVisible

Returns whether the overflow button is visible or not.

GetToolBarFits

Returns whether the AuiToolBar size fits in a specified size.

GetToolBitmap

Returns the tool bitmap for the tool identified by tool_id.

GetToolBitmapSize

Returns the size of bitmap that the toolbar expects to have. The default bitmap size is 16 by 15 pixels.

GetToolBorderPadding

Returns the padding between the tool border and the label, in pixels.

GetToolCount

Returns the number of tools in the AuiToolBar.

GetToolDropDown

Returns whether the toolbar item identified by tool_id has an associated drop down window menu or not.

GetToolEnabled

Returns whether the tool identified by tool_id is enabled or not.

GetToolFits

Returns whether the tool identified by tool_id fits into the toolbar or not.

GetToolFitsByIndex

Returns whether the tool identified by tool_id fits into the toolbar or not.

GetToolIndex

Returns the position of the tool in the toolbar given its identifier.

GetToolLabel

Returns the tool label for the tool identified by tool_id.

GetToolLongHelp

Returns the long help for the given tool.

GetToolOrientation

Returns the orientation for the toolbar items.

GetToolPacking

Returns the value used for spacing tools. The default value is 1 pixel.

GetToolPos

Returns the position of the tool in the toolbar given its identifier.

GetToolProportion

Returns the tool proportion in the toolbar.

GetToolRect

Returns the toolbar item rectangle

GetToolSeparation

Returns the separator size for the toolbar, in pixels.

GetToolShortHelp

Returns the short help for the given tool.

GetToolSticky

Returns whether the toolbar item identified by tool_id has a sticky behaviour or not.

GetToolTextOrientation

Returns the label orientation for the toolbar items.

GetToolToggled

Returns whether a tool is toggled or not.

HitTest

Finds a tool for the given mouse position.

IsPaneMinimized

Returns whether this AuiToolBar contains a minimized pane tool.

OnCustomRender

Handles custom render for single AuiToolBar items.

OnEraseBackground

Handles the wx.EVT_ERASE_BACKGROUND event for AuiToolBar.

OnIdle

Handles the wx.EVT_IDLE event for AuiToolBar.

OnLeaveWindow

Handles the wx.EVT_LEAVE_WINDOW event for AuiToolBar.

OnLeftDown

Handles the wx.EVT_LEFT_DOWN event for AuiToolBar.

OnLeftUp

Handles the wx.EVT_LEFT_UP event for AuiToolBar.

OnMiddleDown

Handles the wx.EVT_MIDDLE_DOWN event for AuiToolBar.

OnMiddleUp

Handles the wx.EVT_MIDDLE_UP event for AuiToolBar.

OnMotion

Handles the wx.EVT_MOTION event for AuiToolBar.

OnPaint

Handles the wx.EVT_PAINT event for AuiToolBar.

OnRightDown

Handles the wx.EVT_RIGHT_DOWN event for AuiToolBar.

OnRightUp

Handles the wx.EVT_RIGHT_UP event for AuiToolBar.

OnSetCursor

Handles the wx.EVT_SET_CURSOR event for AuiToolBar.

OnSize

Handles the wx.EVT_SIZE event for AuiToolBar.

Realize

Realizes the toolbar. This function should be called after you have added tools.

RefreshOverflowState

Refreshes the overflow button.

SetAGWWindowStyleFlag

Sets the AGW-specific style of the window.

SetArtProvider

Instructs AuiToolBar to use art provider specified by parameter art

SetAuiManager

Sets the AuiManager which manages the toolbar.

SetCustomOverflowItems

Sets the two lists prepend and append as custom overflow items.

SetFont

Sets the AuiToolBar font.

SetGripperVisible

Sets whether the toolbar gripper is visible or not.

SetHoverItem

Sets a toolbar item to be currently hovered by the mouse.

SetMargins

Set the values to be used as margins for the toolbar.

SetMarginsSize

Set the values to be used as margins for the toolbar.

SetMarginsXY

Set the values to be used as margins for the toolbar.

SetOrientation

Sets the toolbar orientation.

SetOverflowVisible

Sets whether the overflow button is visible or not.

SetPressedItem

Sets a toolbar item to be currently in a “pressed” state.

SetToolAlignment

This sets the alignment for all of the tools within the toolbar

SetToolBitmap

Sets the tool bitmap for the tool identified by tool_id.

SetToolBitmapSize

Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 pixels.

SetToolBorderPadding

Sets the padding between the tool border and the label.

SetToolDisabledBitmap

Sets the tool disabled bitmap for the tool identified by tool_id.

SetToolDropDown

Assigns a drop down window menu to the toolbar item.

SetToolLabel

Sets the tool label for the tool identified by tool_id.

SetToolLongHelp

Sets the long help for the given tool.

SetToolNormalBitmap

Sets the tool bitmap for the tool identified by tool_id.

SetToolOrientation

Sets the tool orientation for the toolbar items.

SetToolPacking

Sets the value used for spacing tools. The default value is 1 pixel.

SetToolProportion

Sets the tool proportion in the toolbar.

SetToolSeparation

Sets the separator size for the toolbar.

SetToolShortHelp

Sets the short help for the given tool.

SetToolSticky

Sets the toolbar item as sticky or non-sticky.

SetToolTextOrientation

Sets the label orientation for the toolbar items.

SetWindowStyleFlag

Sets the style of the window.

StartPreviewTimer

Starts a timer in AuiManager to slide-in/slide-out the minimized pane.

StopPreviewTimer

Stops a timer in AuiManager to slide-in/slide-out the minimized pane.

ToggleTool

Toggles a tool on or off. This does not cause any event to get emitted.


api Class API

class AuiToolBar(wx.Control)

AuiToolBar is a completely owner-drawn toolbar perfectly integrated with the AUI layout system. This allows drag and drop of toolbars, docking/floating behaviour and the possibility to define “overflow” items in the toolbar itself.

The default theme that is used is AuiDefaultToolBarArt, which provides a modern, glossy look and feel. The theme can be changed by calling AuiToolBar.SetArtProvider.


Methods

__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=AUI_TB_DEFAULT_STYLE)

Default class constructor.

Parameters:
  • parent (wx.Window) – the AuiToolBar parent;

  • id (integer) – an identifier for the control: a value of -1 is taken to mean a default;

  • pos (wx.Point) – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;

  • size (wx.Size) – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;

  • style (integer) – the control window style;

  • agwStyle (integer) –

    the AGW-specific window style. This can be a combination of the following bits:

    Flag name

    Description

    AUI_TB_TEXT

    Shows the text in the toolbar buttons; by default only icons are shown

    AUI_TB_NO_TOOLTIPS

    Don’t show tooltips on AuiToolBar items

    AUI_TB_NO_AUTORESIZE

    Do not auto-resize the AuiToolBar

    AUI_TB_GRIPPER

    Shows a gripper on the AuiToolBar

    AUI_TB_OVERFLOW

    The AuiToolBar can contain overflow items

    AUI_TB_VERTICAL

    The AuiToolBar is vertical

    AUI_TB_HORZ_LAYOUT

    Shows the text and the icons alongside, not vertically stacked. This style must be used with AUI_TB_TEXT

    AUI_TB_PLAIN_BACKGROUND

    Don’t draw a gradient background on the toolbar

    AUI_TB_HORZ_TEXT

    Combination of AUI_TB_HORZ_LAYOUT and AUI_TB_TEXT

    The default value for agwStyle is: AUI_TB_DEFAULT_STYLE = 0



AddCheckTool(self, tool_id, label, bitmap, disabled_bitmap, short_help_string="", long_help_string="", client_data=None)

Adds a new check (or toggle) tool to the AuiToolBar.

See also

AddTool for an explanation of the input parameters.



AddControl(self, control, label="")

Adds any control to the toolbar, typically e.g. a ComboBox.

Parameters:
  • control (wx.Window) – the control to be added;

  • label (string) – the label which appears if the control goes into the overflow items in the toolbar.



AddLabel(self, tool_id, label="", width=0)

Adds a label tool to the AuiToolBar.

Parameters:
  • tool_id (integer) – an integer by which the tool may be identified in subsequent operations;

  • label (string) – the toolbar tool label;

  • width (integer) – the tool width.



AddRadioTool(self, tool_id, label, bitmap, disabled_bitmap, short_help_string="", long_help_string="", client_data=None)

Adds a new radio tool to the toolbar.

Consecutive radio tools form a radio group such that exactly one button in the group is pressed at any moment, in other words whenever a button in the group is pressed the previously pressed button is automatically released. You should avoid having the radio groups of only one element as it would be impossible for the user to use such button.

Note

By default, the first button in the radio group is initially pressed, the others are not.

See also

AddTool for an explanation of the input parameters.



AddSeparator(self)

Adds a separator for spacing groups of tools.



AddSimpleTool(self, tool_id, label, bitmap, short_help_string="", kind=ITEM_NORMAL, target=None)

Adds a tool to the toolbar. This is the simplest method you can use to add an item to the AuiToolBar.

Parameters:
  • tool_id (integer) – an integer by which the tool may be identified in subsequent operations;

  • label (string) – the toolbar tool label;

  • bitmap (wx.Bitmap) – the primary tool bitmap;

  • short_help_string (string) – this string is used for the tools tooltip;

  • kind (integer) – the item kind. Can be one of the following:

    Item Kind

    Description

    ITEM_CONTROL

    The item in the AuiToolBar is a control

    ITEM_LABEL

    The item in the AuiToolBar is a text label

    ITEM_SPACER

    The item in the AuiToolBar is a spacer

    ITEM_SEPARATOR

    The item in the AuiToolBar is a separator

    ITEM_CHECK

    The item in the AuiToolBar is a toolbar check item

    ITEM_NORMAL

    The item in the AuiToolBar is a standard toolbar item

    ITEM_RADIO

    The item in the AuiToolBar is a toolbar radio item

  • target – a custom string indicating that an instance of AuiPaneInfo has been minimized into this toolbar.



AddSpacer(self, pixels)

Adds a spacer for spacing groups of tools.

Parameters:

pixels (integer) – the width of the spacer.



AddStretchSpacer(self, proportion=1)

Adds a stretchable spacer for spacing groups of tools.

Parameters:

proportion (integer) – the stretchable spacer proportion.



AddToggleTool(self, tool_id, bitmap, disabled_bitmap, toggle=False, client_data=None, short_help_string="", long_help_string="")

Adds a toggle tool to the toolbar.

Parameters:
  • tool_id (integer) – an integer by which the tool may be identified in subsequent operations;

  • bitmap (wx.Bitmap) – the primary tool bitmap;

  • disabled_bitmap (wx.Bitmap) – the bitmap to use when the tool is disabled. If it is equal to NullBitmap, the disabled bitmap is automatically generated by greing the normal one;

  • client_data (PyObject) – whatever Python object to associate with the toolbar item;

  • short_help_string (string) – this string is used for the tools tooltip;

  • long_help_string (string) – this string is shown in the statusbar (if any) of the parent frame when the mouse pointer is inside the tool.



AddTool(self, tool_id, label, bitmap, disabled_bitmap, kind, short_help_string='', long_help_string='', client_data=None, target=None)

Adds a tool to the toolbar. This is the full feature version of AddTool.

Parameters:
  • tool_id (integer) – an integer by which the tool may be identified in subsequent operations;

  • label (string) – the toolbar tool label;

  • bitmap (wx.Bitmap) – the primary tool bitmap;

  • disabled_bitmap (wx.Bitmap) – the bitmap to use when the tool is disabled. If it is equal to NullBitmap, the disabled bitmap is automatically generated by greing the normal one;

  • kind (integer) – the item kind. Can be one of the following:

    Item Kind

    Description

    ITEM_CONTROL

    The item in the AuiToolBar is a control

    ITEM_LABEL

    The item in the AuiToolBar is a text label

    ITEM_SPACER

    The item in the AuiToolBar is a spacer

    ITEM_SEPARATOR

    The item in the AuiToolBar is a separator

    ITEM_CHECK

    The item in the AuiToolBar is a toolbar check item

    ITEM_NORMAL

    The item in the AuiToolBar is a standard toolbar item

    ITEM_RADIO

    The item in the AuiToolBar is a toolbar radio item

  • short_help_string (string) – this string is used for the tools tooltip;

  • long_help_string (string) – this string is shown in the statusbar (if any) of the parent frame when the mouse pointer is inside the tool.

  • client_data (PyObject) – whatever Python object to associate with the toolbar item.

  • target – a custom string indicating that an instance of AuiPaneInfo has been minimized into this toolbar.



Clear(self)

Deletes all the tools in the AuiToolBar.



ClearTools(self)

Deletes all the tools in the AuiToolBar.



DeleteTool(self, tool)

Removes the specified tool from the toolbar and deletes it.

Parameters:

tool – the AuiToolBarItem or its integer identifier.

Returns:

True if the tool was deleted, False otherwise.

Note

Note that it is unnecessary to call Realize for the change to take place, it will happen immediately.



DeleteToolByPos(self, pos)

This function behaves like DeleteTool but it deletes the tool at the specified position and not the one with the given id.

Parameters:

pos (integer) – the tool position.

See also

DeleteTool



DoGetBestSize(self)

Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call to Fit().

Note

Overridden from wx.Control.



DoIdleUpdate(self)

Updates the toolbar during idle times.



DoSetSize(self, x, y, width, height, sizeFlags=wx.SIZE_AUTO)

Sets the position and size of the window in pixels. The sizeFlags parameter indicates the interpretation of the other params if they are equal to -1.

Parameters:
  • x (integer) – the window x position;

  • y (integer) – the window y position;

  • width (integer) – the window width;

  • height (integer) – the window height;

  • sizeFlags (integer) – may have one of this bit set:

    Size Flags

    Description

    wx.SIZE_AUTO

    A -1 indicates that a class-specific default should be used.

    wx.SIZE_AUTO_WIDTH

    A -1 indicates that a class-specific default should be used for the width.

    wx.SIZE_AUTO_HEIGHT

    A -1 indicates that a class-specific default should be used for the height.

    wx.SIZE_USE_EXISTING

    Existing dimensions should be used if -1 values are supplied.

    wx.SIZE_ALLOW_MINUS_ONE

    Allow dimensions of -1 and less to be interpreted as real dimensions, not default values.

    wx.SIZE_FORCE

    Normally, if the position and the size of the window are already the same as the parameters of this function, nothing is done. but with this flag a window resize may be forced even in this case (supported in wx 2.6.2 and later and only implemented for MSW and ignored elsewhere currently)

Note

Overridden from wx.Control.



EnableTool(self, tool_id, state)

Enables or disables the tool.

Parameters:
  • tool_id (integer) – identifier for the tool to enable or disable.

  • state (bool) – if True, enables the tool, otherwise disables it.



FindControl(self, id)

Returns a pointer to the control identified by id or None if no corresponding control is found.

Parameters:

id (integer) – the control identifier.



FindTool(self, tool_id)

Finds a tool for the given tool id.

Parameters:

tool_id (integer) – the AuiToolBarItem identifier.



FindToolByIndex(self, pos)

Finds a tool for the given tool position in the AuiToolBar.

Parameters:

pos (integer) – the tool position in the toolbar.

Returns:

a pointer to a AuiToolBarItem if a tool is found, or None otherwise.



FindToolByLabel(self, label)

Finds a tool for the given label.

Parameters:

label (string) – the AuiToolBarItem label.



FindToolByUserData(self, userData)

Finds a tool for the given client id.

Parameters:

userData (PyObject) – the user data object.



FindToolForPosition(self, x, y)

Finds a tool for the given mouse position.

Parameters:
  • x (integer) – mouse x position;

  • y (integer) – mouse y position.

Returns:

a pointer to a AuiToolBarItem if a tool is found, or None otherwise.



FindToolForPositionWithPacking(self, x, y)

Finds a tool for the given mouse position, taking into account also the tool packing.

Parameters:
  • x (integer) – mouse x position;

  • y (integer) – mouse y position.

Returns:

a pointer to a AuiToolBarItem if a tool is found, or None otherwise.



GetAGWWindowStyleFlag(self)

Returns the AGW-specific window style flag.

See also

SetAGWWindowStyleFlag for an explanation of various AGW-specific style.



GetArtProvider(self)

Returns the current art provider being used.



GetAuiManager(self)

Returns the AuiManager which manages the toolbar.



GetGripperVisible(self)

Returns whether the toolbar gripper is visible or not.



GetLabelSize(self, label)

Returns the standard size of a toolbar item.

Parameters:

label (string) – a test label.



GetOverflowRect(self)

Returns the rectangle of the overflow button.



GetOverflowState(self)

Returns the state of the overflow button.



GetOverflowVisible(self)

Returns whether the overflow button is visible or not.



GetToolBarFits(self)

Returns whether the AuiToolBar size fits in a specified size.



GetToolBitmap(self, tool_id)

Returns the tool bitmap for the tool identified by tool_id.

Parameters:

tool_id (integer) – the tool identifier.



GetToolBitmapSize(self)

Returns the size of bitmap that the toolbar expects to have. The default bitmap size is 16 by 15 pixels.

Note

Note that this is the size of the bitmap you pass to AddTool, and not the eventual size of the tool button.

Todo

Add ToolBar compatibility, actually implementing this method.



GetToolBorderPadding(self)

Returns the padding between the tool border and the label, in pixels.



GetToolCount(self)

Returns the number of tools in the AuiToolBar.



GetToolDropDown(self, tool_id)

Returns whether the toolbar item identified by tool_id has an associated drop down window menu or not.

Parameters:

tool_id (integer) – the AuiToolBarItem identifier.



GetToolEnabled(self, tool_id)

Returns whether the tool identified by tool_id is enabled or not.

Parameters:

tool_id (integer) – the tool identifier.



GetToolFits(self, tool_id)

Returns whether the tool identified by tool_id fits into the toolbar or not.

Parameters:

tool_id (integer) – the toolbar item identifier.



GetToolFitsByIndex(self, tool_id)

Returns whether the tool identified by tool_id fits into the toolbar or not.

Parameters:

tool_id (integer) – the toolbar item identifier.



GetToolIndex(self, tool_id)

Returns the position of the tool in the toolbar given its identifier.

Parameters:

tool_id (integer) – the toolbar item identifier.



GetToolLabel(self, tool_id)

Returns the tool label for the tool identified by tool_id.

Parameters:

tool_id (integer) – the tool identifier.



GetToolLongHelp(self, tool_id)

Returns the long help for the given tool.

Parameters:

tool_id (integer) – the tool identifier.



GetToolOrientation(self)

Returns the orientation for the toolbar items.



GetToolPacking(self)

Returns the value used for spacing tools. The default value is 1 pixel.



GetToolPos(self, tool_id)

Returns the position of the tool in the toolbar given its identifier.

Parameters:

tool_id (integer) – the toolbar item identifier.



GetToolProportion(self, tool_id)

Returns the tool proportion in the toolbar.

Parameters:

tool_id (integer) – the AuiToolBarItem identifier.



GetToolRect(self, tool_id)

Returns the toolbar item rectangle

Parameters:

tool_id (integer) – the toolbar item identifier.



GetToolSeparation(self)

Returns the separator size for the toolbar, in pixels.



GetToolShortHelp(self, tool_id)

Returns the short help for the given tool.

Parameters:

tool_id (integer) – the tool identifier.



GetToolSticky(self, tool_id)

Returns whether the toolbar item identified by tool_id has a sticky behaviour or not.

Parameters:

tool_id (integer) – the AuiToolBarItem identifier.



GetToolTextOrientation(self)

Returns the label orientation for the toolbar items.



GetToolToggled(self, tool_id)

Returns whether a tool is toggled or not.

Parameters:

tool_id (integer) – the toolbar item identifier.

Note

This only applies to a tool that has been specified as a toggle tool.



HitTest(self, x, y)

Finds a tool for the given mouse position.

Parameters:
  • x (integer) – mouse x screen position;

  • y (integer) – mouse y screen position.

Returns:

a pointer to a AuiToolBarItem if a tool is found, or None otherwise.

Note

This method is similar to FindToolForPosition but it works with absolute coordinates.



IsPaneMinimized(self)

Returns whether this AuiToolBar contains a minimized pane tool.



OnCustomRender(self, dc, item, rect)

Handles custom render for single AuiToolBar items.

Parameters:

Note

This method must be overridden to provide custom rendering of items.



OnEraseBackground(self, event)

Handles the wx.EVT_ERASE_BACKGROUND event for AuiToolBar.

Parameters:

event – a EraseEvent event to be processed.

Note

This is intentionally empty, to reduce flicker.



OnIdle(self, event)

Handles the wx.EVT_IDLE event for AuiToolBar.

Parameters:

event – a IdleEvent event to be processed.



OnLeaveWindow(self, event)

Handles the wx.EVT_LEAVE_WINDOW event for AuiToolBar.

Parameters:

event – a MouseEvent event to be processed.



OnLeftDown(self, event)

Handles the wx.EVT_LEFT_DOWN event for AuiToolBar.

Parameters:

event – a MouseEvent event to be processed.



OnLeftUp(self, event)

Handles the wx.EVT_LEFT_UP event for AuiToolBar.

Parameters:

event – a MouseEvent event to be processed.



OnMiddleDown(self, event)

Handles the wx.EVT_MIDDLE_DOWN event for AuiToolBar.

Parameters:

event – a MouseEvent event to be processed.



OnMiddleUp(self, event)

Handles the wx.EVT_MIDDLE_UP event for AuiToolBar.

Parameters:

event – a MouseEvent event to be processed.



OnMotion(self, event)

Handles the wx.EVT_MOTION event for AuiToolBar.

Parameters:

event – a MouseEvent event to be processed.



OnPaint(self, event)

Handles the wx.EVT_PAINT event for AuiToolBar.

Parameters:

event – a PaintEvent event to be processed.



OnRightDown(self, event)

Handles the wx.EVT_RIGHT_DOWN event for AuiToolBar.

Parameters:

event – a MouseEvent event to be processed.



OnRightUp(self, event)

Handles the wx.EVT_RIGHT_UP event for AuiToolBar.

Parameters:

event – a MouseEvent event to be processed.



OnSetCursor(self, event)

Handles the wx.EVT_SET_CURSOR event for AuiToolBar.

Parameters:

event – a SetCursorEvent event to be processed.



OnSize(self, event)

Handles the wx.EVT_SIZE event for AuiToolBar.

Parameters:

event – a wx.SizeEvent event to be processed.



Realize(self)

Realizes the toolbar. This function should be called after you have added tools.



RefreshOverflowState(self)

Refreshes the overflow button.



SetAGWWindowStyleFlag(self, agwStyle)

Sets the AGW-specific style of the window.

Parameters:

agwStyle (integer) –

the new window style. This can be a combination of the following bits:

Flag name

Description

AUI_TB_TEXT

Shows the text in the toolbar buttons; by default only icons are shown

AUI_TB_NO_TOOLTIPS

Don’t show tooltips on AuiToolBar items

AUI_TB_NO_AUTORESIZE

Do not auto-resize the AuiToolBar

AUI_TB_GRIPPER

Shows a gripper on the AuiToolBar

AUI_TB_OVERFLOW

The AuiToolBar can contain overflow items

AUI_TB_VERTICAL

The AuiToolBar is vertical

AUI_TB_HORZ_LAYOUT

Shows the text and the icons alongside, not vertically stacked. This style must be used with AUI_TB_TEXT

AUI_TB_PLAIN_BACKGROUND

Don’t draw a gradient background on the toolbar

AUI_TB_HORZ_TEXT

Combination of AUI_TB_HORZ_LAYOUT and AUI_TB_TEXT

Note

Please note that some styles cannot be changed after the window creation and that Refresh might need to be be called after changing the others for the change to take place immediately.



SetArtProvider(self, art)

Instructs AuiToolBar to use art provider specified by parameter art for all drawing calls. This allows pluggable look-and-feel features.

Parameters:

art – an art provider.

Note

The previous art provider object, if any, will be deleted by AuiToolBar.



SetAuiManager(self, auiManager)

Sets the AuiManager which manages the toolbar.



SetCustomOverflowItems(self, prepend, append)

Sets the two lists prepend and append as custom overflow items.

Parameters:


SetFont(self, font)

Sets the AuiToolBar font.

Parameters:

font (wx.Font) – the new toolbar font.

Note

Overridden from wx.Control.



SetGripperVisible(self, visible)

Sets whether the toolbar gripper is visible or not.

Parameters:

visible (bool) – True for a visible gripper, False otherwise.



SetHoverItem(self, pitem)

Sets a toolbar item to be currently hovered by the mouse.

Parameters:

pitem – an instance of AuiToolBarItem.



SetMargins(self, left=-1, right=-1, top=-1, bottom=-1)

Set the values to be used as margins for the toolbar.

Parameters:
  • left (integer) – the left toolbar margin;

  • right (integer) – the right toolbar margin;

  • top (integer) – the top toolbar margin;

  • bottom (integer) – the bottom toolbar margin.



SetMarginsSize(self, size)

Set the values to be used as margins for the toolbar.

Parameters:

size (wx.Size) – the margin size (an instance of wx.Size).



SetMarginsXY(self, x, y)

Set the values to be used as margins for the toolbar.

Parameters:
  • x (integer) – left margin, right margin and inter-tool separation value;

  • y (integer) – top margin, bottom margin and inter-tool separation value.



SetOrientation(self, orientation)

Sets the toolbar orientation.

Parameters:

orientation (integer) – either wx.VERTICAL or wx.HORIZONTAL.

Note

This can be temporarily overridden by AuiManager when floating and docking a AuiToolBar.



SetOverflowVisible(self, visible)

Sets whether the overflow button is visible or not.

Parameters:

visible (bool) – True for a visible overflow button, False otherwise.



SetPressedItem(self, pitem)

Sets a toolbar item to be currently in a “pressed” state.

Parameters:

pitem – an instance of AuiToolBarItem.



SetToolAlignment(self, alignment=wx.EXPAND)

This sets the alignment for all of the tools within the toolbar (only has an effect when the toolbar is expanded).

Parameters:

alignment (integer) – wx.Sizer alignment value (wx.ALIGN_CENTER_HORIZONTAL or wx.ALIGN_CENTER_VERTICAL).



SetToolBitmap(self, tool_id, bitmap)

Sets the tool bitmap for the tool identified by tool_id.

Parameters:
  • tool_id (integer) – the tool identifier;

  • bitmap (wx.Bitmap) – the new bitmap for the toolbar item.



SetToolBitmapSize(self, size)

Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 pixels.

Parameters:

size (wx.Size) – the size of the bitmaps in the toolbar.

Note

This should be called to tell the toolbar what the tool bitmap size is. Call it before you add tools.

Note

Note that this is the size of the bitmap you pass to AddTool, and not the eventual size of the tool button.

Todo

Add ToolBar compatibility, actually implementing this method.



SetToolBorderPadding(self, padding)

Sets the padding between the tool border and the label.

Parameters:

padding (integer) – the padding in pixels.



SetToolDisabledBitmap(self, tool_id, bitmap)

Sets the tool disabled bitmap for the tool identified by tool_id.

Parameters:
  • tool_id (integer) – the tool identifier;

  • bitmap (wx.Bitmap) – the new disabled bitmap for the toolbar item.



SetToolDropDown(self, tool_id, dropdown)

Assigns a drop down window menu to the toolbar item.

Parameters:
  • tool_id (integer) – the AuiToolBarItem identifier;

  • dropdown (bool) – whether to assign a drop down menu or not.



SetToolLabel(self, tool_id, label)

Sets the tool label for the tool identified by tool_id.

Parameters:
  • tool_id (integer) – the tool identifier;

  • label (string) – the new toolbar item label.



SetToolLongHelp(self, tool_id, help_string)

Sets the long help for the given tool.

Parameters:
  • tool_id (integer) – the tool identifier;

  • help_string (string) – the string for the long help.



SetToolNormalBitmap(self, tool_id, bitmap)

Sets the tool bitmap for the tool identified by tool_id.

Parameters:
  • tool_id (integer) – the tool identifier;

  • bitmap (wx.Bitmap) – the new bitmap for the toolbar item.



SetToolOrientation(self, orientation)

Sets the tool orientation for the toolbar items.

Parameters:

orientation (integer) – the AuiToolBarItem orientation.



SetToolPacking(self, packing)

Sets the value used for spacing tools. The default value is 1 pixel.

Parameters:

packing (integer) – the value for packing.



SetToolProportion(self, tool_id, proportion)

Sets the tool proportion in the toolbar.

Parameters:
  • tool_id (integer) – the AuiToolBarItem identifier;

  • proportion (integer) – the tool proportion in the toolbar.



SetToolSeparation(self, separation)

Sets the separator size for the toolbar.

Parameters:

separation (integer) – the separator size in pixels.



SetToolShortHelp(self, tool_id, help_string)

Sets the short help for the given tool.

Parameters:
  • tool_id (integer) – the tool identifier;

  • help_string (string) – the string for the short help.



SetToolSticky(self, tool_id, sticky)

Sets the toolbar item as sticky or non-sticky.

Parameters:
  • tool_id (integer) – the AuiToolBarItem identifier;

  • sticky (bool) – whether the tool should be sticky or not.



SetToolTextOrientation(self, orientation)

Sets the label orientation for the toolbar items.

Parameters:

orientation (integer) – the AuiToolBarItem label orientation.



SetWindowStyleFlag(self, style)

Sets the style of the window.

Parameters:

style (integer) – the new window style.

Note

Please note that some styles cannot be changed after the window creation and that Refresh might need to be be called after changing the others for the change to take place immediately.

Note

Overridden from wx.Control.



StartPreviewTimer(self)

Starts a timer in AuiManager to slide-in/slide-out the minimized pane.



StopPreviewTimer(self)

Stops a timer in AuiManager to slide-in/slide-out the minimized pane.



ToggleTool(self, tool_id, state)

Toggles a tool on or off. This does not cause any event to get emitted.

Parameters:
  • tool_id (integer) – tool in question.

  • state (bool) – if True, toggles the tool on, otherwise toggles it off.

Note

This only applies to a tool that has been specified as a toggle tool.