.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.ToolBar:

==========================================================================================================================================
|phoenix_title|  **wx.ToolBar**
==========================================================================================================================================

A toolbar is a bar of buttons and/or other controls usually placed below the menu bar in a :ref:`wx.Frame`.          

You may create a toolbar that is managed by a frame calling :meth:`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 :ref:`wx.ToolBar`  as usual. 

There are several different types of tools you can add to a toolbar. These types are controlled by the :ref:`wx.ItemKind`  enumeration. 

Note that many methods in :ref:`wx.ToolBar`  such as :meth:`wx.ToolBar.AddTool`   return a  ``ToolBarToolBase*``   object. This should be regarded as an opaque handle representing the newly added toolbar item, providing access to its id and position within the toolbar. Changes to the item's state should be made through calls to  :ref:`wx.ToolBar`  methods, for example :meth:`wx.ToolBar.EnableTool` . Calls to  :ref:`wx.ToolBarToolBase`  methods (undocumented by purpose) will not change the visible state of the item within the tool bar. 

**wxMSW note**: Note that under wxMSW 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: ::

        if wx.GetApp().GetComCtl32Version() >= 600 and wx.DisplayDepth() >= 32:
            # Use the 32-bit images
            wx.SystemOptions.SetOption("msw.remap", 2)







.. _ToolBar-styles:

|styles| Window Styles
================================

This class supports the following styles: 

  

- ``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  ``TB_TEXT`` .   
- ``wx.TB_HORZ_TEXT``: Combination of  ``TB_HORZ_LAYOUT``   and   ``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.  
- ``wx.TB_DEFAULT_STYLE``: Combination of  ``TB_HORIZONTAL``   and   ``TB_FLAT`` . This style is new since wxWidgets 2.9.5.   

See also
:ref:`Window Styles <window styles>`. Note that the wxMSW native toolbar ignores  ``TB_NOICONS``   style. Also, toggling the   ``TB_TEXT``   works only if the style was initially on. 







.. _ToolBar-events:

|events| Events Emitted by this Class
=====================================

Handlers bound for the following event types will receive a :ref:`wx.CommandEvent` parameter.


- EVT_TOOL: Process a  ``wxEVT_TOOL``   event (a synonym for   ``wxEVT_MENU`` ). Pass the id of the tool.   
- EVT_MENU: The same as EVT_TOOL().  
- EVT_TOOL_RANGE: Process a  ``wxEVT_TOOL``   event for a range of identifiers. Pass the ids of the tools.   
- EVT_MENU_RANGE: The same as EVT_TOOL_RANGE().  
- EVT_TOOL_RCLICKED: Process a  ``wxEVT_TOOL_RCLICKED``   event. Pass the id of the tool. (Not available on wxOSX.)   
- EVT_TOOL_RCLICKED_RANGE: Process a  ``wxEVT_TOOL_RCLICKED``   event for a range of ids. Pass the ids of the tools. (Not available on wxOSX.)   
- EVT_TOOL_ENTER: Process a  ``wxEVT_TOOL_ENTER``   event. Pass the id of the toolbar itself. The value of  :meth:`wx.CommandEvent.GetSelection`   is the tool id, or -1 if the mouse cursor has moved off a tool. (Not available on wxOSX.)  
- EVT_TOOL_DROPDOWN: Process a  ``wxEVT_TOOL_DROPDOWN``   event. If unhandled, displays the default dropdown menu set using  :meth:`wx.ToolBar.SetDropdownMenu` .  

The toolbar class emits menu commands in the same way that a frame menubar does, so you can use one EVT_MENU() macro for both a menu item and a toolbar button. The event handler functions take a
:ref:`wx.CommandEvent`  argument. For most event macros, the identifier of the tool is passed, but for EVT_TOOL_ENTER() the toolbar window identifier is passed and the tool identifier is retrieved from the :ref:`wx.CommandEvent`. This is because the identifier may be  ``ID_ANY``   when the mouse moves off a tool, and   ``ID_ANY``   is not allowed as an identifier in the event system. 







         



.. seealso:: :ref:`Toolbar Overview <toolbar overview>`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>ToolBar</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.ToolBar_inheritance.png" alt="Inheritance diagram of ToolBar" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Control.html" title="wx.Control" alt="" coords="60,237,148,267"/> <area shape="rect" id="node6" href="wx.ToolBar.html" title="wx.ToolBar" alt="" coords="60,315,148,344"/> <area shape="rect" id="node2" href="wx.Window.html" title="wx.Window" alt="" coords="59,160,148,189"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,87,35"/> <area shape="rect" id="node4" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="48,83,159,112"/> <area shape="rect" id="node5" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="112,5,213,35"/> </map> 
   </p>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.ToolBar.__init__`                                                     Default constructor.
:meth:`~wx.ToolBar.AddCheckTool`                                                 Adds a new check (or toggle) tool to the toolbar.
:meth:`~wx.ToolBar.AddControl`                                                   Adds any control to the toolbar, typically e.g. a :ref:`wx.ComboBox`.
:meth:`~wx.ToolBar.AddLabelTool`                                                 Old style method to add a tool in the toolbar.
:meth:`~wx.ToolBar.AddRadioTool`                                                 Adds a new radio tool to the toolbar.
:meth:`~wx.ToolBar.AddSeparator`                                                 Adds a separator for spacing groups of tools.
:meth:`~wx.ToolBar.AddSimpleTool`                                                Old style method to add a tool to the toolbar.
:meth:`~wx.ToolBar.AddStretchableSpace`                                          Adds a stretchable space to the toolbar.
:meth:`~wx.ToolBar.AddTool`                                                      Adds a tool to the toolbar.
:meth:`~wx.ToolBar.ClearTools`                                                   Deletes all the tools in the toolbar.
:meth:`~wx.ToolBar.CreateTool`                                                   Factory function to create a new toolbar tool.
:meth:`~wx.ToolBar.DeleteTool`                                                   Removes the specified tool from the toolbar and deletes it.
:meth:`~wx.ToolBar.DeleteToolByPos`                                              This function behaves like :meth:`~ToolBar.DeleteTool`   but it deletes the tool at the specified position and not the one with the given id.
:meth:`~wx.ToolBar.EnableTool`                                                   Enables or disables the tool.
:meth:`~wx.ToolBar.FindById`                                                     Returns a pointer to the tool identified by `id`  or ``None`` if no corresponding tool is found.
:meth:`~wx.ToolBar.FindControl`                                                  Returns a pointer to the control identified by `id`  or ``None`` if no corresponding control is found.
:meth:`~wx.ToolBar.FindToolForPosition`                                          Finds a tool for the given mouse position.
:meth:`~wx.ToolBar.GetMargins`                                                   Returns the left/right and top/bottom margins, which are also used for inter-toolspacing.
:meth:`~wx.ToolBar.GetToolBitmapSize`                                            Returns the size of bitmap that the toolbar expects to have.
:meth:`~wx.ToolBar.GetToolByPos`                                                 Returns a pointer to the tool at ordinal position `pos`.
:meth:`~wx.ToolBar.GetToolClientData`                                            Get any client data associated with the tool.
:meth:`~wx.ToolBar.GetToolEnabled`                                               Called to determine whether a tool is enabled (responds to user input).
:meth:`~wx.ToolBar.GetToolLongHelp`                                              Returns the long help for the given tool.
:meth:`~wx.ToolBar.GetToolPacking`                                               Returns the value used for packing tools.
:meth:`~wx.ToolBar.GetToolPos`                                                   Returns the tool position in the toolbar, or  ``NOT_FOUND``   if the tool is not found.
:meth:`~wx.ToolBar.GetToolSeparation`                                            Returns the default separator size.
:meth:`~wx.ToolBar.GetToolShortHelp`                                             Returns the short help for the given tool.
:meth:`~wx.ToolBar.GetToolSize`                                                  Returns the size of a whole button, which is usually larger than a tool bitmap because of added 3D effects.
:meth:`~wx.ToolBar.GetToolState`                                                 Gets the on/off state of a toggle tool.
:meth:`~wx.ToolBar.GetToolsCount`                                                Returns the number of tools in the toolbar.
:meth:`~wx.ToolBar.InsertControl`                                                Inserts the control into the toolbar at the given position.
:meth:`~wx.ToolBar.InsertLabelTool`                                              Old style method to insert a tool in the toolbar.
:meth:`~wx.ToolBar.InsertSeparator`                                              Inserts the separator into the toolbar at the given position.
:meth:`~wx.ToolBar.InsertSimpleTool`                                             Old style method to insert a tool in the toolbar.
:meth:`~wx.ToolBar.InsertStretchableSpace`                                       Inserts a stretchable space at the given position.
:meth:`~wx.ToolBar.InsertTool`                                                   Inserts the tool with the specified attributes into the toolbar at the given position.
:meth:`~wx.ToolBar.Realize`                                                      This function should be called after you have added tools.
:meth:`~wx.ToolBar.RemoveTool`                                                   Removes the given tool from the toolbar but doesn't delete it.
:meth:`~wx.ToolBar.SetDropdownMenu`                                              Sets the dropdown menu for the tool given by its `id`.
:meth:`~wx.ToolBar.SetMargins`                                                   Set the values to be used as margins for the toolbar.
:meth:`~wx.ToolBar.SetToolBitmapSize`                                            Sets the default size of each tool bitmap.
:meth:`~wx.ToolBar.SetToolClientData`                                            Sets the client data associated with the tool.
:meth:`~wx.ToolBar.SetToolDisabledBitmap`                                        Sets the bitmap to be used by the tool with the given ``ID`` when the tool is in a disabled state.
:meth:`~wx.ToolBar.SetToolLongHelp`                                              Sets the long help for the given tool.
:meth:`~wx.ToolBar.SetToolNormalBitmap`                                          Sets the bitmap to be used by the tool with the given ``ID``.
:meth:`~wx.ToolBar.SetToolPacking`                                               Sets the value used for spacing tools.
:meth:`~wx.ToolBar.SetToolSeparation`                                            Sets the default separator size.
:meth:`~wx.ToolBar.SetToolShortHelp`                                             Sets the short help for the given tool.
:meth:`~wx.ToolBar.ToggleTool`                                                   Toggles a tool on or off.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.ToolBar.Margins`                                                      See :meth:`~wx.ToolBar.GetMargins` and :meth:`~wx.ToolBar.SetMargins`
:attr:`~wx.ToolBar.ToolBitmapSize`                                               See :meth:`~wx.ToolBar.GetToolBitmapSize` and :meth:`~wx.ToolBar.SetToolBitmapSize`
:attr:`~wx.ToolBar.ToolPacking`                                                  See :meth:`~wx.ToolBar.GetToolPacking` and :meth:`~wx.ToolBar.SetToolPacking`
:attr:`~wx.ToolBar.ToolSeparation`                                               See :meth:`~wx.ToolBar.GetToolSeparation` and :meth:`~wx.ToolBar.SetToolSeparation`
:attr:`~wx.ToolBar.ToolSize`                                                     See :meth:`~wx.ToolBar.GetToolSize`
:attr:`~wx.ToolBar.ToolsCount`                                                   See :meth:`~wx.ToolBar.GetToolsCount`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.ToolBar(Control)

   **Possible constructors**::

       ToolBar()
       
       ToolBar(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
               style=TB_HORIZONTAL, name=ToolBarNameStr)
       
   
   A toolbar is a bar of buttons and/or other controls usually placed
   below the menu bar in a Frame.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self)`
      
      Default constructor.                   
      
      
      
      
      **~~~**

      
      **__init__** `(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=TB_HORIZONTAL, name=ToolBarNameStr)`
      
      Constructs a toolbar.                  
      
      
      
      
      :param `parent`: Pointer to a parent window.   
      :type `parent`: wx.Window
      :param `id`: Window identifier. If -1, will automatically create an identifier.   
      :type `id`: wx.WindowID
      :param `pos`: Window position. :ref:`wx.DefaultPosition`  indicates that wxWidgets should generate a default position for the window. If using the :ref:`wx.Window`  class directly, supply an actual position.   
      :type `pos`: wx.Point
      :param `size`: Window size. :ref:`wx.DefaultSize`  indicates that wxWidgets should generate a default size for the window.   
      :type `size`: wx.Size
      :param `style`: Window style. See :ref:`wx.ToolBar`  initial description for details.   
      :type `style`: long
      :param `name`: Window name.  
      :type `name`: string
      
      
      
      
      
      
      
      
      
      
      
      
      
      
                        
      
      
      
      .. note:: 
      
         After a toolbar is created, you use :meth:`AddTool`   and perhaps :meth:`AddSeparator` , and then you must call :meth:`Realize`   to construct and display the toolbar tools.   
      
      
      
      
      
      
      
      **~~~**






   .. method:: AddCheckTool(self, toolId, label, bitmap1, bmpDisabled=NullBitmap, shortHelp=EmptyString, longHelp=EmptyString, clientData=None)

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

      The parameters are the same as in :meth:`AddTool` . 

                


      :param `toolId`: 
      :type `toolId`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap1`: 
      :type `bitmap1`: wx.Bitmap
      :param `bmpDisabled`: 
      :type `bmpDisabled`: wx.Bitmap
      :param `shortHelp`: 
      :type `shortHelp`: string
      :param `longHelp`: 
      :type `longHelp`: string
      :param `clientData`: 
      :type `clientData`: PyUserData




      :rtype: :ref:`wx.ToolBarToolBase`







      .. seealso:: :meth:`AddTool`     








   .. method:: AddControl(self, control, label=EmptyString)

      Adds any control to the toolbar, typically e.g. a :ref:`wx.ComboBox`.                  




      :param `control`: The control to be added.   
      :type `control`: wx.Control
      :param `label`: Text to be displayed near the control.  
      :type `label`: string








      :rtype: :ref:`wx.ToolBarToolBase`



                  



      .. note:: 

         wxMSW: the label is only displayed if there is enough space available below the embedded control.  







      .. note:: 

         Mac: labels are only displayed if wxWidgets is built with  ``MAC_USE_NATIVE_TOOLBAR``   set to 1    








   .. method:: AddLabelTool(self, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="", longHelp="", clientData=None)

      Old style method to add a tool in the toolbar.


      .. deprecated:: 4.0.1
         Use :meth:`AddTool` instead.


   .. method:: AddRadioTool(self, toolId, label, bitmap1, bmpDisabled=NullBitmap, shortHelp=EmptyString, longHelp=EmptyString, 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. 

                


      :param `toolId`: 
      :type `toolId`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap1`: 
      :type `bitmap1`: wx.Bitmap
      :param `bmpDisabled`: 
      :type `bmpDisabled`: wx.Bitmap
      :param `shortHelp`: 
      :type `shortHelp`: string
      :param `longHelp`: 
      :type `longHelp`: string
      :param `clientData`: 
      :type `clientData`: PyUserData




      :rtype: :ref:`wx.ToolBarToolBase`







      .. seealso:: :meth:`AddTool`     








   .. method:: AddSeparator(self)

      Adds a separator for spacing groups of tools.                  

      Notice that the separator uses the look appropriate for the current platform so it can be a vertical line (MSW, some versions of GTK) or just an empty space or something else. 

                

      :rtype: :ref:`wx.ToolBarToolBase`







      .. seealso:: :meth:`AddTool` , :meth:`SetToolSeparation` , :meth:`AddStretchableSpace`     








   .. method:: AddSimpleTool(self, toolId, bitmap, shortHelpString="", longHelpString="", isToggle=0)

      Old style method to add a tool to the toolbar.


      .. deprecated:: 4.0.1
         Use :meth:`AddTool` instead.


   .. method:: AddStretchableSpace(self)

      Adds a stretchable space to the toolbar.                  

      Any space not taken up by the fixed items (all items except for stretchable spaces) is distributed in equal measure between the stretchable spaces in the toolbar. The most common use for this method is to add a single stretchable space before the items which should be right-aligned in the toolbar, but more exotic possibilities are possible, e.g. a stretchable space may be added in the beginning and the end of the toolbar to centre all toolbar items. 

                

      :rtype: :ref:`wx.ToolBarToolBase`







      .. versionadded:: 2.9.1 
     







      .. seealso:: :meth:`AddTool` , :meth:`AddSeparator` , :meth:`InsertStretchableSpace`   








   .. method:: AddTool(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **AddTool** `(self, tool)`
      
      Adds a tool to the toolbar.                  
      
      
      
      
      :param `tool`: The tool to be added.  
      :type `tool`: wx.ToolBarToolBase
      
      
      
      
      
      
      :rtype: :ref:`wx.ToolBarToolBase`
      
      
      
                        
      
      
      
      .. note:: 
      
         After you have added tools to a toolbar, you must call :meth:`Realize`   in order to have the tools appear.  
      
      
      
      
      
      
      
      .. seealso:: :meth:`AddSeparator` , :meth:`AddCheckTool` , :meth:`AddRadioTool` , :meth:`InsertTool` , :meth:`DeleteTool` , :meth:`Realize` , :meth:`SetDropdownMenu`     
      
      
      
      
      
      
      
      **~~~**

      
      **AddTool** `(self, toolId, label, bitmap, shortHelp=EmptyString, kind=ITEM_NORMAL)`
      
      Adds a tool to the toolbar.                  
      
      This most commonly used version has fewer parameters than the full version below which specifies the more rarely used button features. 
      
      
      
      
      :param `toolId`: An integer by which the tool may be identified in subsequent operations.   
      :type `toolId`: int
      :param `label`: The string to be displayed with the tool.   
      :type `label`: string
      :param `bitmap`: The primary tool bitmap.   
      :type `bitmap`: wx.Bitmap
      :param `shortHelp`: This string is used for the tools tooltip.   
      :type `shortHelp`: string
      :param `kind`: May be ``ITEM_NORMAL``  for a normal button (default), ``ITEM_CHECK``  for a checkable tool (such tool stays pressed after it had been toggled) or ``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. ``ITEM_DROPDOWN``  specifies that a drop-down menu button will appear next to the tool button (only GTK+ and MSW). Call :meth:`SetDropdownMenu`   afterwards.  
      :type `kind`: wx.ItemKind
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      :rtype: :ref:`wx.ToolBarToolBase`
      
      
      
                        
      
      
      
      .. note:: 
      
         After you have added tools to a toolbar, you must call :meth:`Realize`   in order to have the tools appear.  
      
      
      
      
      
      
      
      .. seealso:: :meth:`AddSeparator` , :meth:`AddCheckTool` , :meth:`AddRadioTool` , :meth:`InsertTool` , :meth:`DeleteTool` , :meth:`Realize` , :meth:`SetDropdownMenu`     
      
      
      
      
      
      
      
      **~~~**

      
      **AddTool** `(self, toolId, label, bitmap, bmpDisabled, kind=ITEM_NORMAL, shortHelp=EmptyString, longHelp=EmptyString, clientData=None)`
      
      Adds a tool to the toolbar.                  
      
      
      
      
      :param `toolId`: An integer by which the tool may be identified in subsequent operations.   
      :type `toolId`: int
      :param `label`: The string to be displayed with the tool.   
      :type `label`: string
      :param `bitmap`: The primary tool bitmap.   
      :type `bitmap`: wx.Bitmap
      :param `bmpDisabled`: The bitmap used when the tool is disabled. If it is equal to :ref:`wx.NullBitmap`  (default), the disabled bitmap is automatically generated by greying the normal one.   
      :type `bmpDisabled`: wx.Bitmap
      :param `kind`: May be ``ITEM_NORMAL``  for a normal button (default), ``ITEM_CHECK``  for a checkable tool (such tool stays pressed after it had been toggled) or ``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. ``ITEM_DROPDOWN``  specifies that a drop-down menu button will appear next to the tool button (only GTK+ and MSW). Call :meth:`SetDropdownMenu`   afterwards.   
      :type `kind`: wx.ItemKind
      :param `shortHelp`: 
      :type `shortHelp`: string
      :param `longHelp`: 
      :type `longHelp`: string
      :param `clientData`: An optional pointer to client data which can be retrieved later using :meth:`GetToolClientData` .  
      :type `clientData`: PyUserData
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      This string is used for the tools tooltip.  
      
      
      
      This string is shown in the statusbar (if any) of the parent frame when the mouse pointer is inside the tool.  
      
      
      
      
      
      :rtype: :ref:`wx.ToolBarToolBase`
      
      
      
                        
      
      
      
      .. note:: 
      
         After you have added tools to a toolbar, you must call :meth:`Realize`   in order to have the tools appear.  
      
      
      
      
      
      
      
      .. seealso:: :meth:`AddSeparator` , :meth:`AddCheckTool` , :meth:`AddRadioTool` , :meth:`InsertTool` , :meth:`DeleteTool` , :meth:`Realize` , :meth:`SetDropdownMenu`     
      
      
      
      
      
      
      
      **~~~**






   .. method:: ClearTools(self)

      Deletes all the tools in the toolbar.                   





   .. method:: CreateTool(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **CreateTool** `(self, toolId, label, bmpNormal, bmpDisabled=NullBitmap, kind=ITEM_NORMAL, clientData=None, shortHelp=EmptyString, longHelp=EmptyString)`
      
      Factory function to create a new toolbar tool.                  
      
      
      :param `toolId`: 
      :type `toolId`: int
      :param `label`: 
      :type `label`: string
      :param `bmpNormal`: 
      :type `bmpNormal`: wx.Bitmap
      :param `bmpDisabled`: 
      :type `bmpDisabled`: wx.Bitmap
      :param `kind`: 
      :type `kind`: wx.ItemKind
      :param `clientData`: 
      :type `clientData`: PyUserData
      :param `shortHelp`: 
      :type `shortHelp`: string
      :param `longHelp`: 
      :type `longHelp`: string
      
      
      
      
      :rtype: :ref:`wx.ToolBarToolBase`
      
      
      
      
      
      
      
      **~~~**

      
      **CreateTool** `(self, control, label)`
      
      Factory function to create a new control toolbar tool.                  
      
      
      :param `control`: 
      :type `control`: wx.Control
      :param `label`: 
      :type `label`: string
      
      
      
      
      :rtype: :ref:`wx.ToolBarToolBase`
      
      
      
      
      
      
      
      **~~~**






   .. method:: DeleteTool(self, toolId)

      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 :meth:`RemoveTool`   instead. 

                


      :param `toolId`: 
      :type `toolId`: int




      :rtype: `bool`







      :returns: 

         ``True`` if the tool was deleted, ``False`` otherwise.  







      .. note:: 

         It is unnecessary to call :meth:`Realize`   for the change to take place, it will happen immediately.  







      .. seealso:: :meth:`DeleteToolByPos`     








   .. method:: DeleteToolByPos(self, pos)

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


      :param `pos`: 
      :type `pos`: int




      :rtype: `bool`








   .. method:: EnableTool(self, toolId, enable)

      Enables or disables the tool.                  




      :param `toolId`: ``ID`` of the tool to enable or disable, as passed to :meth:`AddTool` .   
      :type `toolId`: int
      :param `enable`: If ``True``, enables the tool, otherwise disables it.  
      :type `enable`: bool






                  



      .. note:: 

         Some implementations will change the visible state of the tool to indicate that it is disabled.  







      .. seealso:: :meth:`GetToolEnabled` , :meth:`ToggleTool`     








   .. method:: FindById(self, id)

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


      :param `id`: 
      :type `id`: int




      :rtype: :ref:`wx.ToolBarToolBase`








   .. method:: FindControl(self, id)

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


      :param `id`: 
      :type `id`: int




      :rtype: :ref:`wx.Control`








   .. method:: FindToolForPosition(self, x, y)

      Finds a tool for the given mouse position.                  




      :param `x`: X position.   
      :type `x`: int
      :param `y`: Y position.  
      :type `y`: int








      :rtype: :ref:`wx.ToolBarToolBase`



                  



      :returns: 

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







      .. note:: 

         Currently not implemented in wxGTK (always returns ``None`` there).   








   .. method:: GetMargins(self)

      Returns the left/right and top/bottom margins, which are also used for inter-toolspacing.                  

                

      :rtype: :ref:`wx.Size`







      .. seealso:: :meth:`SetMargins`     








   .. method:: GetToolBitmapSize(self)

      Returns the size of bitmap that the toolbar expects to have.                  

      The default bitmap size is platform-dependent: for example, it is 16x15 for MSW and 24x24 for GTK. This size does `not`  necessarily indicate the best size to use for the toolbars on the given platform, for this you should use  ``ArtProvider::GetNativeSizeHint(wxART_TOOLBAR)``   but in any case, as the bitmap size is deduced automatically from the size of the bitmaps associated with the tools added to the toolbar, it is usually unnecessary to call  :meth:`SetToolBitmapSize`   explicitly. 

                

      :rtype: :ref:`wx.Size`







      .. note:: 

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







      .. seealso:: :meth:`SetToolBitmapSize` , :meth:`GetToolSize`     








   .. method:: GetToolByPos(self, pos)

      Returns a pointer to the tool at ordinal position `pos`.                  

      Don't confuse this with :meth:`FindToolForPosition` . 

                


      :param `pos`: 
      :type `pos`: int




      :rtype: :ref:`wx.ToolBarToolBase`







      .. versionadded:: 2.9.1 
    







      .. seealso:: :meth:`GetToolsCount`     








   .. method:: GetToolClientData(self, toolId)

      Get any client data associated with the tool.                  




      :param `toolId`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .  
      :type `toolId`: int






      :rtype: :ref:`PyUserData`



                  



      :returns: 

         Client data, or ``None`` if there is none.   








   .. method:: GetToolEnabled(self, toolId)

      Called to determine whether a tool is enabled (responds to user input).                  




      :param `toolId`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .  
      :type `toolId`: int






      :rtype: `bool`



                  



      :returns: 

         ``True`` if the tool is enabled, ``False`` otherwise.  







      .. seealso:: :meth:`EnableTool`     








   .. method:: GetToolLongHelp(self, toolId)

      Returns the long help for the given tool.                  




      :param `toolId`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .  
      :type `toolId`: int






      :rtype: `string`



                  



      .. seealso:: :meth:`SetToolLongHelp` , :meth:`SetToolShortHelp`     








   .. method:: GetToolPacking(self)

      Returns the value used for packing tools.                  

                

      :rtype: `int`







      .. seealso:: :meth:`SetToolPacking`     








   .. method:: GetToolPos(self, toolId)

      Returns the tool position in the toolbar, or  ``NOT_FOUND``   if the tool is not found.                   




      :param `toolId`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .   
      :type `toolId`: int






      :rtype: `int`



                  





   .. method:: GetToolSeparation(self)

      Returns the default separator size.                  

                

      :rtype: `int`







      .. seealso:: :meth:`SetToolSeparation`     








   .. method:: GetToolShortHelp(self, toolId)

      Returns the short help for the given tool.                  




      :param `toolId`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .  
      :type `toolId`: int






      :rtype: `string`



                  



      .. seealso:: :meth:`GetToolLongHelp` , :meth:`SetToolShortHelp`     








   .. method:: GetToolSize(self)

      Returns the size of a whole button, which is usually larger than a tool bitmap because of added 3D effects.                  

                

      :rtype: :ref:`wx.Size`







      .. seealso:: :meth:`SetToolBitmapSize` , :meth:`GetToolBitmapSize`     








   .. method:: GetToolState(self, toolId)

      Gets the on/off state of a toggle tool.                  




      :param `toolId`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .  
      :type `toolId`: int






      :rtype: `bool`



                  



      :returns: 

         ``True`` if the tool is toggled on, ``False`` otherwise.  







      .. seealso:: :meth:`ToggleTool`     








   .. method:: GetToolsCount(self)

      Returns the number of tools in the toolbar.                  

      :rtype: `int`








   .. method:: InsertControl(self, pos, control, label=EmptyString)

      Inserts the control into the toolbar at the given position.                  

      You must call :meth:`Realize`   for the change to take place. 

                


      :param `pos`: 
      :type `pos`: int
      :param `control`: 
      :type `control`: wx.Control
      :param `label`: 
      :type `label`: string




      :rtype: :ref:`wx.ToolBarToolBase`







      .. seealso:: :meth:`AddControl` , :meth:`InsertTool`     








   .. method:: InsertLabelTool(self, pos, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="", longHelp="", clientData=None)

      Old style method to insert a tool in the toolbar.


      .. deprecated:: 4.0.1
         Use :meth:`InsertTool` instead.


   .. method:: InsertSeparator(self, pos)

      Inserts the separator into the toolbar at the given position.                  

      You must call :meth:`Realize`   for the change to take place. 

                


      :param `pos`: 
      :type `pos`: int




      :rtype: :ref:`wx.ToolBarToolBase`







      .. seealso:: :meth:`AddSeparator` , :meth:`InsertTool`     








   .. method:: InsertSimpleTool(self, pos, toolId, bitmap, shortHelpString="", longHelpString="", isToggle=0)

      Old style method to insert a tool in the toolbar.


      .. deprecated:: 4.0.1
         Use :meth:`InsertTool` instead.


   .. method:: InsertStretchableSpace(self, pos)

      Inserts a stretchable space at the given position.                  

      See :meth:`AddStretchableSpace`   for details about stretchable spaces. 

                


      :param `pos`: 
      :type `pos`: int




      :rtype: :ref:`wx.ToolBarToolBase`







      .. versionadded:: 2.9.1 
     







      .. seealso:: :meth:`InsertTool` , :meth:`InsertSeparator`   








   .. method:: InsertTool(self, *args, **kw)

      Inserts the tool with the specified attributes into the toolbar at the given position.                  

      You must call :meth:`Realize`   for the change to take place. 

                 



      :returns: 

         The newly inserted tool or ``None`` on failure. Notice that with the overload taking `tool`  parameter the caller is responsible for deleting the tool in the latter case.   







      .. seealso:: :meth:`AddTool` , :meth:`InsertControl` , :meth:`InsertSeparator`   





      |overload| Overloaded Implementations:

      **~~~**

      
      **InsertTool** `(self, pos, toolId, label, bitmap, bmpDisabled=NullBitmap, kind=ITEM_NORMAL, shortHelp=EmptyString, longHelp=EmptyString, clientData=None)`
      
      
      
      
      :param `pos`: 
      :type `pos`: int
      :param `toolId`: 
      :type `toolId`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `bmpDisabled`: 
      :type `bmpDisabled`: wx.Bitmap
      :param `kind`: 
      :type `kind`: wx.ItemKind
      :param `shortHelp`: 
      :type `shortHelp`: string
      :param `longHelp`: 
      :type `longHelp`: string
      :param `clientData`: 
      :type `clientData`: PyUserData
      
      
      
      
      :rtype: :ref:`wx.ToolBarToolBase`
      
      
      
      
      
      
      
      **~~~**

      
      **InsertTool** `(self, pos, tool)`
      
      
      
      
      :param `pos`: 
      :type `pos`: int
      :param `tool`: 
      :type `tool`: wx.ToolBarToolBase
      
      
      
      
      :rtype: :ref:`wx.ToolBarToolBase`
      
      
      
      
      
      
      
      **~~~**






   .. method:: Realize(self)

      This function should be called after you have added tools.                  

      :rtype: `bool`








   .. method:: RemoveTool(self, id)

      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. 

                


      :param `id`: 
      :type `id`: int




      :rtype: :ref:`wx.ToolBarToolBase`







      .. note:: 

         It is unnecessary to call :meth:`Realize`   for the change to take place, it will happen immediately.  







      .. seealso:: :meth:`DeleteTool`     








   .. method:: SetDropdownMenu(self, id, menu)

      Sets the dropdown menu for the tool given by its `id`.                  

      The tool itself will delete the menu when it's no longer needed. Only supported under GTK+ und MSW. 

      If you define a EVT_TOOL_DROPDOWN() handler in your program, you must call :meth:`wx.Event.Skip`   from it or the menu won't be displayed.                  


      :param `id`: 
      :type `id`: int
      :param `menu`: 
      :type `menu`: wx.Menu




      :rtype: `bool`








   .. method:: SetMargins(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **SetMargins** `(self, x, y)`
      
      Set the values to be used as margins for the toolbar.                  
      
      
      
      
      :param `x`: Left margin, right margin and inter-tool separation value.   
      :type `x`: int
      :param `y`: Top margin, bottom margin and inter-tool separation value.  
      :type `y`: int
      
      
      
      
      
      
                        
      
      
      
      .. 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:: :meth:`GetMargins`     
      
      
      
      
      
      
      
      **~~~**

      
      **SetMargins** `(self, size)`
      
      Set the margins for the toolbar.                  
      
      
      
      
      :param `size`: Margin size.  
      :type `size`: wx.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:: :meth:`GetMargins` , :ref:`wx.Size`    
      
      
      
      
      
      
      
      **~~~**






   .. method:: SetToolBitmapSize(self, size)

      Sets the default size of each tool bitmap.                  

      The default bitmap size is 16 by 15 pixels. 




      :param `size`: The size of the bitmaps in the toolbar.  
      :type `size`: wx.Size




                  



      .. note:: 

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







      .. seealso:: :meth:`GetToolBitmapSize` , :meth:`GetToolSize`     








   .. method:: SetToolClientData(self, id, clientData)

      Sets the client data associated with the tool.                  




      :param `id`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .   
      :type `id`: int
      :param `clientData`: The client data to use.   
      :type `clientData`: PyUserData






                  





   .. method:: SetToolDisabledBitmap(self, 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. 




      :param `id`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .   
      :type `id`: int
      :param `bitmap`: Bitmap to use for disabled tools.  
      :type `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(self, toolId, helpString)

      Sets the long help for the given tool.                  




      :param `toolId`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .   
      :type `toolId`: int
      :param `helpString`: A string for the long help.  
      :type `helpString`: string






                  



      .. note:: 

         You might use the long help for displaying the tool purpose on the status line.  







      .. seealso:: :meth:`GetToolLongHelp` , :meth:`SetToolShortHelp` ,   








   .. method:: SetToolNormalBitmap(self, 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. 




      :param `id`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .   
      :type `id`: int
      :param `bitmap`: Bitmap to use for normals tools.   
      :type `bitmap`: wx.Bitmap






                  





   .. method:: SetToolPacking(self, packing)

      Sets the value used for spacing tools.                  

      The default value is 1. 




      :param `packing`: The value for packing.  
      :type `packing`: int




                  



      .. 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:: :meth:`GetToolPacking`     








   .. method:: SetToolSeparation(self, separation)

      Sets the default separator size.                  

      The default value is 5. 




      :param `separation`: The separator size.  
      :type `separation`: int




                  



      .. seealso:: :meth:`AddSeparator`     








   .. method:: SetToolShortHelp(self, toolId, helpString)

      Sets the short help for the given tool.                  




      :param `toolId`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .   
      :type `toolId`: int
      :param `helpString`: The string for the short help.  
      :type `helpString`: string






                  



      .. note:: 

         An application might use short help for identifying the tool purpose in a tooltip.  







      .. seealso:: :meth:`GetToolShortHelp` , :meth:`SetToolLongHelp`     








   .. method:: ToggleTool(self, toolId, toggle)

      Toggles a tool on or off.                  

      This does not cause any event to get emitted. 




      :param `toolId`: ``ID`` of the tool in question, as passed to :meth:`AddTool` .   
      :type `toolId`: int
      :param `toggle`: If ``True``, toggles the tool on, otherwise toggles it off.  
      :type `toggle`: bool






                  



      .. note:: 

         Only applies to a tool that has been specified as a toggle tool.   








   .. attribute:: Margins

      See :meth:`~wx.ToolBar.GetMargins` and :meth:`~wx.ToolBar.SetMargins`


   .. attribute:: ToolBitmapSize

      See :meth:`~wx.ToolBar.GetToolBitmapSize` and :meth:`~wx.ToolBar.SetToolBitmapSize`


   .. attribute:: ToolPacking

      See :meth:`~wx.ToolBar.GetToolPacking` and :meth:`~wx.ToolBar.SetToolPacking`


   .. attribute:: ToolSeparation

      See :meth:`~wx.ToolBar.GetToolSeparation` and :meth:`~wx.ToolBar.SetToolSeparation`


   .. attribute:: ToolSize

      See :meth:`~wx.ToolBar.GetToolSize`


   .. attribute:: ToolsCount

      See :meth:`~wx.ToolBar.GetToolsCount`

