********** wx.ToolBar ********** Inheritance diagram for `wx.ToolBar`: | .. inheritance-diagram:: wx.ToolBar | Description =========== The name `wx.ToolBar` is defined to be a synonym for one of the following classes: * `wx.ToolBar95`: The native Windows 95 toolbar. Used on Windows 95, NT 4 and above. * `wx.ToolBarMSW`: A Windows implementation. Used on 16-bit Windows. * `wx.ToolBarGTK`: The GTK toolbar. .. seealso:: `wx.ScrolledWindow `_ Derived From ^^^^^^^^^^^^^ * `wx.Control `_ * `wx.Window `_ * `wx.EvtHandler `_ * `wx.Object `_ Window Styles ^^^^^^^^^^^^^ ================================================== ================================================== Window Style Description ================================================== ================================================== ``wx.TB_FLAT`` Gives the toolbar a flat look (Windows and GTK only). ``wx.TB_DOCKABLE`` Makes the toolbar floatable and dockable (GTK only). ``wx.TB_HORIZONTAL`` Specifies horizontal layout (default). ``wx.TB_VERTICAL`` Specifies vertical layout. ``wx.TB_TEXT`` Shows the text in the toolbar buttons; by default only icons are shown. ``wx.TB_NOICONS`` Specifies no icons in the toolbar buttons; by default they are shown. ``wx.TB_NODIVIDER`` Specifies no divider (border) above the toolbar (Windows only). ``wx.TB_NOALIGN`` Specifies no alignment with the parent window (Windows only, not very useful). ``wx.TB_HORZ_LAYOUT`` Shows the text and the icons alongside, not vertically stacked (Windows and GTK 2 only). This style must be used with ``wx.TB_TEXT``. ``wx.TB_HORZ_TEXT`` Combination of ``wx.TB_HORZ_LAYOUT`` and ``wx.TB_TEXT``. ``wx.TB_NO_TOOLTIPS`` Don't show the short help tooltips for the tools when the mouse hovers over them. ``wx.TB_BOTTOM`` Align the toolbar at the bottom of parent window. ``wx.TB_RIGHT`` Align the toolbar at the right side of parent window. ================================================== ================================================== Remarks ^^^^^^^ You may also create a toolbar that is managed by the frame, by calling `wx.Frame.CreateToolBar `_. Under Pocket PC, you should *always* use this function for creating the toolbar to be managed by the frame, so that wxWidgets can use a combined menubar and toolbar. Where you manage your own toolbars, create a `wx.ToolBar` as usual. The meaning of a "separator" is a vertical line under Windows and simple space under GTK+. **wx.ToolBar95**: Note that this toolbar paints tools to reflect system-wide colours. If you use more than 16 colours in your tool bitmaps, you may wish to suppress this behaviour, otherwise system colours in your bitmaps will inadvertently be mapped to system colours. To do this, set the `msw.remap` system option before creating the toolbar:: wx.SystemOptions.SetOption("msw.remap", 0) If you wish to use 32-bit images (which include an alpha channel for transparency) use:: wx.SystemOptions.SetOption("msw.remap", 2) Then colour remapping is switched off, and a transparent background used. But only use this option under Windows XP with true colour:: theApp.GetComCtl32Version() >= 600 and wx.DisplayDepth() >= 32 Event Handling ^^^^^^^^^^^^^^ The toolbar class emits menu commands in the same way that a frame menubar does, so you can use one ``wx.EVT_MENU`` event for both a menu item and a toolbar button. The event handler functions take a `wx.CommandEvent `_ argument. For most event, the identifier of the tool is passed, but for ``wx.EVT_TOOL_ENTER`` the toolbar window identifier is passed and the tool identifier is retrieved from the `wx.CommandEvent`. This is because the identifier may be -1 when the mouse moves off a tool, and -1 is not allowed as an identifier in the event system. ================================================== ================================================== Event Name Description ================================================== ================================================== wx.EVT_TOOL(id, func) Process a ``wx.wxEVT_COMMAND_TOOL_CLICKED`` event (a synonym for ``wx.wxEVT_COMMAND_MENU_SELECTED``). Pass the id of the tool. wx.EVT_MENU(id, func) The same as ``EVT_TOOL``. wx.EVT_TOOL_RANGE(id1, id2, func) Process a ``wx.wxEVT_COMMAND_TOOL_CLICKED`` event for a range of identifiers. Pass the ids of the tools. wx.EVT_MENU_RANGE(id1, id2, func) The same as ``EVT_TOOL_RANGE``. wx.EVT_TOOL_RCLICKED(id, func) Process a ``wx.wxEVT_COMMAND_TOOL_RCLICKED`` event. Pass the id of the tool. wx.EVT_TOOL_RCLICKED_RANGE(id1, id2, func) Process a ``wx.wxEVT_COMMAND_TOOL_RCLICKED`` event for a range of ids. Pass the ids of the tools. wx.EVT_TOOL_ENTER(id, func) Process a ``wx.wxEVT_COMMAND_TOOL_ENTER`` event. Pass the id of the toolbar itself. The value of `wx.CommandEvent.GetSelection `_ is the tool id, or -1 if the mouse cursor has moved off a tool. ================================================== ================================================== Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `AddCheckLabelTool <#AddCheckLabelTool>`_ * `AddCheckTool <#AddCheckTool>`_ * `AddControl <#AddControl>`_ * `AddLabelTool <#AddLabelTool>`_ * `AddRadioLabelTool <#AddRadioLabelTool>`_ * `AddRadioTool <#AddRadioTool>`_ * `AddSeparator <#AddSeparator>`_ * `AddSimpleTool <#AddSimpleTool>`_ * `AddTool <#AddTool>`_ * `AddToolItem <#AddToolItem>`_ * `ClearTools <#ClearTools>`_ * `DeleteTool <#DeleteTool>`_ * `DeleteToolByPos <#DeleteToolByPos>`_ * `EnableTool <#EnableTool>`_ * `FindById <#FindById>`_ * `FindControl <#FindControl>`_ * `FindToolForPosition <#FindToolForPosition>`_ * `GetMargins <#GetMargins>`_ * `GetToolBitmapSize <#GetToolBitmapSize>`_ * `GetToolClientData <#GetToolClientData>`_ * `GetToolEnabled <#GetToolEnabled>`_ * `GetToolLongHelp <#GetToolLongHelp>`_ * `GetToolPacking <#GetToolPacking>`_ * `GetToolPos <#GetToolPos>`_ * `GetToolSeparation <#GetToolSeparation>`_ * `GetToolShortHelp <#GetToolShortHelp>`_ * `GetToolSize <#GetToolSize>`_ * `GetToolState <#GetToolState>`_ * `GetToolsCount <#GetToolsCount>`_ * `InsertControl <#InsertControl>`_ * `InsertLabelTool <#InsertLabelTool>`_ * `InsertSeparator <#InsertSeparator>`_ * `InsertSimpleTool <#InsertSimpleTool>`_ * `InsertTool <#InsertTool>`_ * `InsertToolItem <#InsertToolItem>`_ * `Realize <#Realize>`_ * `RemoveTool <#RemoveTool>`_ * `SetMargins <#SetMargins>`_ * `SetMarginsXY <#SetMarginsXY>`_ * `SetToolBitmapSize <#SetToolBitmapSize>`_ * `SetToolClientData <#SetToolClientData>`_ * `SetToolDisabledBitmap <#SetToolDisabledBitmap>`_ * `SetToolLongHelp <#SetToolLongHelp>`_ * `SetToolNormalBitmap <#SetToolNormalBitmap>`_ * `SetToolPacking <#SetToolPacking>`_ * `SetToolSeparation <#SetToolSeparation>`_ * `SetToolShortHelp <#SetToolShortHelp>`_ * `ToggleTool <#ToggleTool>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER|wx.TB_HORIZONTAL, name=wx.ToolBarNameStr) Constructs a toolbar. **Parameters:** * `parent` (`wx.Window `_) * `id` (int) * `pos` (`wx.Point `_) * `size` (`wx.Size `_) * `style` (long) * `name` (string) | **Returns:** `wx.ToolBar `_ -------- .. method:: AddCheckLabelTool(id, label, bitmap, bmpDisabled=wx.NullBitmap, shortHelp='', longHelp='', clientData=None) Adds a new check (or toggle) tool to the toolbar. **Parameters:** * `id` (int): An integer by which the tool may be identified in subsequent operations. * `label` (string): The tool label. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `bmpDisabled` (`wx.Bitmap `_): The bitmap used when the tool is disabled. If it is equal to `wx.NullBitmap`, the disabled bitmap is automatically generated by greing the normal one. * `shortHelp` (string): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `clientData` (PyObject): An optional pointer to client data which can be retrieved later using `GetToolClientData <#GetToolClientData>`_. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear .. seealso:: `AddTool <#AddTool>`_ -------- .. method:: AddCheckTool(id, bitmap, bmpDisabled=wx.NullBitmap, shortHelp='', longHelp='', clientData=None) Adds a new check (or toggle) tool to the toolbar. **Parameters:** * `id` (int): An integer by which the tool may be identified in subsequent operations. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `bmpDisabled` (`wx.Bitmap `_): The bitmap used when the tool is disabled. If it is equal to `wx.NullBitmap`, the disabled bitmap is automatically generated by greing the normal one. * `shortHelp` (string): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `clientData` (PyObject): An optional pointer to client data which can be retrieved later using `GetToolClientData <#GetToolClientData>`_. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear .. seealso:: `AddTool <#AddTool>`_ -------- .. method:: AddControl(control) Adds any control to the toolbar, typically e.g. a combobox. **Parameters:** * `control` (`wx.Control `_): The control to be added. | **Returns:** `bool` -------- .. method:: AddLabelTool(id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=0, shortHelp='', longHelp='', clientData=None) Adds a new label tool to the toolbar. **Parameters:** * `id` (int): An integer by which the tool may be identified in subsequent operations. * `label` (string): The tool label. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `bmpDisabled` (`wx.Bitmap `_): The bitmap used when the tool is disabled. If it is equal to `wx.NullBitmap`, the disabled bitmap is automatically generated by greing the normal one. * `kind` (int): 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) or ``wx.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): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `clientData` (PyObject): An optional pointer to client data which can be retrieved later using `GetToolClientData <#GetToolClientData>`_. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear .. seealso:: `AddTool <#AddTool>`_ -------- .. method:: AddRadioLabelTool(id, label, bitmap, bmpDisabled=wx.NullBitmap, shortHelp='', longHelp='', clientData=None) Add a radio tool, i.e. a tool which can be toggled and releases any other toggled radio tools in the same group when it happens. **Parameters:** * `id` (int): An integer by which the tool may be identified in subsequent operations. * `label` (string): The tool label. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `bmpDisabled` (`wx.Bitmap `_): The bitmap used when the tool is disabled. If it is equal to `wx.NullBitmap`, the disabled bitmap is automatically generated by greing the normal one. * `shortHelp` (string): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `clientData` (PyObject): An optional pointer to client data which can be retrieved later using `GetToolClientData <#GetToolClientData>`_. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear .. seealso:: `AddTool <#AddTool>`_ -------- .. method:: AddRadioTool(id, bitmap, bmpDisabled=wx.NullBitmap, shortHelp='', longHelp='', clientData=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. By default, the first button in the radio group is initially pressed, the others are not. **Parameters:** * `id` (int): An integer by which the tool may be identified in subsequent operations. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `bmpDisabled` (`wx.Bitmap `_): The bitmap used when the tool is disabled. If it is equal to `wx.NullBitmap`, the disabled bitmap is automatically generated by greing the normal one. * `shortHelp` (string): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `clientData` (PyObject): An optional pointer to client data which can be retrieved later using `GetToolClientData <#GetToolClientData>`_. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear .. seealso:: `AddTool <#AddTool>`_ -------- .. method:: AddSeparator() Adds a separator for spacing groups of tools. .. seealso:: `AddTool <#AddTool>`_, `SetToolSeparation <#SetToolSeparation>`_ -------- .. method:: AddSimpleTool(id, bitmap, shortHelp='', longHelp='', kind=0) Old way to add a new tool to the toolbar. **Parameters:** * `id` (int): An integer by which the tool may be identified in subsequent operations. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `shortHelp` (string): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `kind` (int): 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) or ``wx.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. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear -------- .. method:: AddTool(id, bitmap, bmpDisabled=wx.NullBitmap, kind=0, shortHelp='', longHelp='', clientData=None) Old way to add a new tool to the toolbar. **Parameters:** * `id` (int): An integer by which the tool may be identified in subsequent operations. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `bmpDisabled` (`wx.Bitmap `_): The bitmap used when the tool is disabled. If it is equal to `wx.NullBitmap`, the disabled bitmap is automatically generated by greing the normal one. * `kind` (int): 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) or ``wx.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): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `clientData` (PyObject): An optional pointer to client data which can be retrieved later using `GetToolClientData <#GetToolClientData>`_. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear .. seealso:: `AddSeparator <#AddSeparator>`_, `AddCheckTool <#AddCheckTool>`_, `AddRadioTool <#AddRadioTool>`_, `InsertTool <#InsertTool>`_, `DeleteTool <#DeleteTool>`_, `Realize <#Realize>`_ -------- .. method:: AddToolItem(id, item) Adds a `wx.ToolBarToolBase` item to the toolbar. **Parameters:** * `item` (`wx.ToolBarToolBase`) -------- .. method:: ClearTools() Deletes all the tools in the toolbar. -------- .. method:: DeleteTool(id) Removes the specified tool from the toolbar and deletes it. If you don't want to delete the tool, but just to remove it from the toolbar (to possibly add it back later), you may use `RemoveTool <#RemoveTool>`_ instead. Returns ``True`` if the tool was deleted, ``False`` otherwise. **Parameters:** * `id` (int): The tool id. | **Returns:** `bool` .. note:: Note that it is unnecessary to call `Realize <#Realize>`_ for the change to take place, it will happen immediately. .. seealso:: `DeleteToolByPos <#DeleteToolByPos>`_ -------- .. method:: DeleteToolByPos(pos) This function behaves like `DeleteTool <#DeleteTool>`_ but it deletes the tool at the specified position and not the one with the given id. **Parameters:** * `pos` (int): The tool position in the `wx.ToolBar`. | **Returns:** `bool` -------- .. method:: EnableTool(toolId, enable) Enables or disables the tool. **Parameters:** * `toolId` (int): Tool to enable or disable. * `enable` (bool): If ``True``, enables the tool, otherwise disables it. .. note:: Some implementations will change the visible state of the tool to indicate that it is disabled. .. seealso:: `GetToolEnabled <#GetToolEnabled>`_, `ToggleTool <#ToggleTool>`_ -------- .. method:: FindById(id) Returns a pointer to the tool identified by `id` or ``None`` if no corresponding tool is found. **Parameters:** * `id` (int): The tool id. | **Returns:** `wxToolBarToolBase` -------- .. method:: FindControl(id) Returns a pointer to the control identified by `id` or ``None`` if no corresponding control is found. **Parameters:** * `id` (int): The control id. | **Returns:** `wx.Control `_ -------- .. method:: FindToolForPosition(x, y) Finds a tool for the given mouse position. **Parameters:** * `x` (int): X position. * `y` (int): Y position. | **Returns:** `wx.ToolBarToolBase` .. note:: Currently not implemented in wxGTK (always returns ``None`` there). -------- .. method:: GetMargins() Returns the left/right and top/bottom margins, which are also used for inter-toolspacing. | **Returns:** `wx.Size `_ .. seealso:: `SetMargins <#SetMargins>`_ -------- .. method:: GetToolBitmapSize() Returns the size of bitmap that the toolbar expects to have. The default bitmap size is 16 by 15 pixels. | **Returns:** `wx.Size `_ .. note:: Note that this is the size of the bitmap you pass to `AddTool <#AddTool>`_, and not the eventual size of the tool button. .. seealso:: `SetToolBitmapSize <#SetToolBitmapSize>`_, `GetToolSize <#GetToolSize>`_ -------- .. method:: GetToolClientData(toolId) Get any client data associated with the tool. **Parameters:** * `toolId` (int): Id of the tool, as passed to `AddTool <#AddTool>`_. | **Returns:** `wx.Object `_ -------- .. method:: GetToolEnabled(toolId) Called to determine whether a tool is enabled (responds to user input). **Parameters:** * `toolId` (int): Id of the tool in question. | **Returns:** `bool` .. seealso:: `EnableTool <#EnableTool>`_ -------- .. method:: GetToolLongHelp(toolId) Returns the long help for the given tool. **Parameters:** * `toolId` (int): The tool in question. | **Returns:** `string` .. seealso:: `SetToolLongHelp <#SetToolLongHelp>`_, `SetToolShortHelp <#SetToolShortHelp>`_ -------- .. method:: GetToolPacking() Returns the value used for packing tools. | **Returns:** `int` .. seealso:: `SetToolPacking <#SetToolPacking>`_ -------- .. method:: GetToolPos(toolId) Returns the tool position in the toolbar, or ``wx.NOT_FOUND`` if the tool is not found. **Parameters:** * `toolId` (int): The tool in question. | **Returns:** `int` -------- .. method:: GetToolSeparation() Returns the default separator size. | **Returns:** `int` .. seealso:: `SetToolSeparation <#SetToolSeparation>`_ -------- .. method:: GetToolShortHelp(toolId) Returns the short help for the given tool. **Parameters:** * `toolId` (int): The tool in question. | **Returns:** `string` .. seealso:: `GetToolLongHelp <#GetToolLongHelp>`_, `SetToolShortHelp <#SetToolShortHelp>`_ -------- .. method:: GetToolSize() Returns the size of a whole button, which is usually larger than a tool bitmap because of added 3D effects. | **Returns:** `wx.Size `_ .. seealso:: `SetToolBitmapSize <#SetToolBitmapSize>`_, `GetToolBitmapSize <#GetToolBitmapSize>`_ -------- .. method:: GetToolState(toolId) Gets the on/off state of a toggle tool. **Parameters:** * `toolId` (int): The tool in question. | **Returns:** `bool` .. seealso:: `ToggleTool <#ToggleTool>`_ -------- .. method:: GetToolsCount() Returns the number of tools in the toolbar. | **Returns:** `int` -------- .. method:: InsertControl(pos, control) Inserts the control into the toolbar at the given position. You must call `Realize <#Realize>`_ for the change to take place. **Parameters:** * `pos` (int): The control position in the `wx.ToolBar`. * `control` (`wx.Control `_): The control to insert. | **Returns:** `wx.ToolBarToolBase` .. seealso:: `AddControl <#AddControl>`_, `InsertTool <#InsertTool>`_ -------- .. method:: InsertLabelTool(pos, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=0, shortHelp='', longHelp='', clientData=None) Inserts a new label tool to the toolbar at the specified position. **Parameters:** * `pos` (int): The control position in the `wx.ToolBar`. * `id` (int): An integer by which the tool may be identified in subsequent operations. * `label` (string): The tool label. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `bmpDisabled` (`wx.Bitmap `_): The bitmap used when the tool is disabled. If it is equal to `wx.NullBitmap`, the disabled bitmap is automatically generated by greing the normal one. * `kind` (int): 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) or ``wx.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): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `clientData` (PyObject): An optional pointer to client data which can be retrieved later using `GetToolClientData <#GetToolClientData>`_. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear .. seealso:: `AddTool <#AddTool>`_ -------- .. method:: InsertSeparator() Inserts the separator into the toolbar at the given position. You must call `Realize <#Realize>`_ for the change to take place. | **Returns:** `wx.ToolBarToolBase` .. seealso:: `AddSeparator <#AddSeparator>`_, `InsertTool <#InsertTool>`_ -------- .. method:: InsertSimpleTool(pos, id, bitmap, shortHelp='', longHelp='', kind=0) Old way to insert a new tool to the toolbar. **Parameters:** * `pos` (int): The control position in the `wx.ToolBar`. * `id` (int): An integer by which the tool may be identified in subsequent operations. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `shortHelp` (string): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `kind` (int): 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) or ``wx.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. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear -------- .. method:: InsertTool(pos, id, bitmap, bmpDisabled=wx.NullBitmap, kind=0, shortHelp='', longHelp='', clientData=None) Old way to insert a new tool to the toolbar. **Parameters:** * `pos` (int): The control position in the `wx.ToolBar`. * `id` (int): An integer by which the tool may be identified in subsequent operations. * `bitmap` (`wx.Bitmap `_): The primary tool bitmap. * `bmpDisabled` (`wx.Bitmap `_): The bitmap used when the tool is disabled. If it is equal to `wx.NullBitmap`, the disabled bitmap is automatically generated by greing the normal one. * `kind` (int): 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) or ``wx.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): This string is used for the tools tooltip. * `longHelp` (string): This string is shown in the `wx.StatusBar `_ (if any) of the parent frame when the mouse pointer is inside the tool. * `clientData` (PyObject): An optional pointer to client data which can be retrieved later using `GetToolClientData <#GetToolClientData>`_. | **Returns:** `wx.ToolBarToolBase` .. note:: After you have added tools to a toolbar, you must call `Realize <#Realize>`_ in order to have the tools appear .. seealso:: `AddSeparator <#AddSeparator>`_, `AddCheckTool <#AddCheckTool>`_, `AddRadioTool <#AddRadioTool>`_, `InsertTool <#InsertTool>`_, `DeleteTool <#DeleteTool>`_, `Realize <#Realize>`_ -------- .. method:: InsertToolItem(pos, item) Inserts a `wx.ToolBarToolBase` item to the toolbar in the specified position. **Parameters:** * `pos` (int): The control position in the `wx.ToolBar`. * `item` (`wx.ToolBarToolBase`) -------- .. method:: Realize() This function should be called after you have added tools. | **Returns:** `bool` -------- .. method:: RemoveTool(toolId) Removes the given tool from the toolbar but doesn't delete it. This allows to insert/add this tool back to this (or another) toolbar later. **Parameters:** * `toolId` (int): The tool in question. | **Returns:** `wx.ToolBarToolBase` .. note:: Note that it is unnecessary to call `Realize <#Realize>`_ for the change to take place, it will happen immediately. .. seealso:: `DeleteTool <#DeleteTool>`_ -------- .. method:: SetMargins(size) Set the values to be used as margins for the toolbar. **Parameters:** * `size` (`wx.Size `_): Margin size. | .. note:: This must be called before the tools are added if absolute positioning is to be used, and the default (zero-size) margins are to be overridden. .. seealso:: `GetMargins <#GetMargins>`_, `wx.Size `_ -------- .. method:: SetMarginsXY(x, y) Set the values to be used as margins for the toolbar. **Parameters:** * `x` (int): Margin size in x direction. * `y` (int): Margin size in y direction. | .. note:: This must be called before the tools are added if absolute positioning is to be used, and the default (zero-size) margins are to be overridden. .. seealso:: `GetMargins <#GetMargins>`_, `wx.Size `_ -------- .. method:: SetToolBitmapSize(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 <#AddTool>`_, and not the eventual size of the tool button. .. seealso:: `wx.ToolBar.GetToolBitmapSize `_, `wx.ToolBar.GetToolSize `_ -------- .. method:: SetToolClientData(toolId, clientData) Sets the client data associated with the tool. **Parameters:** * `toolId` (int): The tool in question. * `clientData` (PyObject): A pointer to client data which can be retrieved later using `GetToolClientData <#GetToolClientData>`_. -------- .. method:: SetToolDisabledBitmap(id, bitmap) Sets the bitmap to be used by the tool with the given `id` when the tool is in a disabled state. This can only be used on Button tools, not controls. **Parameters:** * `id` (int) * `bitmap` (`wx.Bitmap `_) .. note:: The native toolbar classes on the main platforms all synthesize the disabled bitmap from the normal bitmap, so this function will have no effect on those platforms. -------- .. method:: SetToolLongHelp(toolId, helpString) Sets the long help for the given tool. **Parameters:** * `toolId` (int): The tool in question. * `helpString` (string): A string for the long help. .. note:: You might use the long help for displaying the tool purpose on the `wx.StatusBar `_. .. seealso:: `GetToolLongHelp <#GetToolLongHelp>`_, `SetToolShortHelp <#SetToolShortHelp>`_ -------- .. method:: SetToolNormalBitmap(id, bitmap) Sets the bitmap to be used by the tool with the given `id`. This can only be used on Button tools, not controls. **Parameters:** * `id` (int) * `bitmap` (`wx.Bitmap `_) -------- .. method:: SetToolPacking(packing) Sets the value used for spacing tools. The default value is 1. **Parameters:** * `packing` (int): The value for packing. | .. note:: The packing is used for spacing in the vertical direction if the toolbar is horizontal, and for spacing in the horizontal direction if the toolbar is vertical. .. seealso:: `GetToolPacking <#GetToolPacking>`_ -------- .. method:: SetToolSeparation(separation) Sets the default separator size. The default value is 5. **Parameters:** * `separation` (int): The separator size. .. seealso:: `AddSeparator <#AddSeparator>`_ -------- .. method:: SetToolShortHelp(toolId, helpString) Sets the short help for the given tool. **Parameters:** * `toolId` (int): The tool in question. * `helpString` (string): The string for the short help. | .. note:: An application might use short help for identifying the tool purpose in a tooltip. .. seealso:: `wx.ToolBar.GetToolShortHelp `_, `wx.ToolBar.SetToolLongHelp `_ -------- .. method:: ToggleTool(toolId, toggle) Toggles a tool on or off. This does not cause any event to get emitted. **Parameters:** * `toolId` (int): Tool in question. * `toggle` (bool): If ``True``, toggles the tool on, otherwise toggles it off. .. note:: Only applies to a tool that has been specified as a toggle tool.