.. 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.ribbon.RibbonButtonBar:

==========================================================================================================================================
|phoenix_title|  **wx.ribbon.RibbonButtonBar**
==========================================================================================================================================

A ribbon button bar is similar to a traditional toolbar.          

It contains one or more buttons (button bar buttons, not Buttons), each of which has a label and an icon. It differs from a :ref:`wx.ribbon.RibbonToolBar`  in several ways: 

- Individual buttons can grow and contract.  
- Buttons have labels as well as bitmaps.  
- Bitmaps are typically larger (at least 32x32 pixels) on a button bar compared to a tool bar (which typically has 16x15).  
- There is no grouping of buttons on a button bar  
- A button bar typically has a border around each individual button, whereas a tool bar typically has a border around each group of buttons. 








.. _RibbonButtonBar-events:

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

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


- EVT_RIBBONBUTTONBAR_CLICKED: Triggered when the normal (non-dropdown) region of a button on the button bar is clicked.  
- EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED: Triggered when the dropdown region of a button on the button bar is clicked. :meth:`wx.ribbon.RibbonButtonBarEvent.PopupMenu`   should be called by the event handler if it wants to display a popup menu (which is what most dropdown buttons should be doing).  










|

|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>RibbonButtonBar</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.ribbon.RibbonButtonBar_inheritance.png" alt="Inheritance diagram of RibbonButtonBar" 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.ribbon.RibbonControl.html" title="wx.ribbon.RibbonControl" alt="" coords="17,315,191,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"/> <area shape="rect" id="node7" href="wx.ribbon.RibbonButtonBar.html" title="wx.ribbon.RibbonButtonBar" alt="" coords="7,392,201,421"/> </map> 
   </p>

|


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

================================================================================ ================================================================================
:meth:`~wx.ribbon.RibbonButtonBar.__init__`                                      Default constructor.
:meth:`~wx.ribbon.RibbonButtonBar.AddButton`                                     Add a button to the button bar (simple version).
:meth:`~wx.ribbon.RibbonButtonBar.AddDropdownButton`                             Add a dropdown button to the button bar (simple version).
:meth:`~wx.ribbon.RibbonButtonBar.AddHybridButton`                               Add a hybrid button to the button bar (simple version).
:meth:`~wx.ribbon.RibbonButtonBar.AddToggleButton`                               Add a toggle button to the button bar (simple version).
:meth:`~wx.ribbon.RibbonButtonBar.ClearButtons`                                  Delete all buttons from the button bar.
:meth:`~wx.ribbon.RibbonButtonBar.Create`                                        Create a button bar in two-step button bar construction.
:meth:`~wx.ribbon.RibbonButtonBar.DeleteButton`                                  Delete a single button from the button bar.
:meth:`~wx.ribbon.RibbonButtonBar.EnableButton`                                  Enable or disable a single button on the bar.
:meth:`~wx.ribbon.RibbonButtonBar.GetActiveItem`                                 Returns the active item of the button bar or ``None`` if there is none.
:meth:`~wx.ribbon.RibbonButtonBar.GetButtonCount`                                Returns the number of buttons in this button bar.
:meth:`~wx.ribbon.RibbonButtonBar.GetHoveredItem`                                Returns the hovered item of the button bar or ``None`` if there is none.
:meth:`~wx.ribbon.RibbonButtonBar.GetItem`                                       Returns the N-th button of the bar.
:meth:`~wx.ribbon.RibbonButtonBar.GetItemById`                                   Returns the first button having a given id or ``None`` if none matches.
:meth:`~wx.ribbon.RibbonButtonBar.GetItemClientData`                             Get the client object associated with a button.
:meth:`~wx.ribbon.RibbonButtonBar.GetItemId`                                     Returns the id of a button.
:meth:`~wx.ribbon.RibbonButtonBar.GetShowToolTipsForDisabled`                    Sets whether tooltips should be shown for disabled buttons or not.
:meth:`~wx.ribbon.RibbonButtonBar.InsertButton`                                  Inserts a button to the button bar (simple version) at the given position.
:meth:`~wx.ribbon.RibbonButtonBar.InsertDropdownButton`                          Inserts a dropdown button to the button bar (simple version) at the given position.
:meth:`~wx.ribbon.RibbonButtonBar.InsertHybridButton`                            Inserts a hybrid button to the button bar (simple version) at the given position.
:meth:`~wx.ribbon.RibbonButtonBar.InsertToggleButton`                            Inserts a toggle button to the button bar (simple version) at the given position.
:meth:`~wx.ribbon.RibbonButtonBar.Realize`                                       Calculate button layouts and positions.
:meth:`~wx.ribbon.RibbonButtonBar.SetItemClientData`                             Set the client object associated with a button.
:meth:`~wx.ribbon.RibbonButtonBar.SetShowToolTipsForDisabled`                    Indicates whether tooltips are shown for disabled buttons.
:meth:`~wx.ribbon.RibbonButtonBar.ToggleButton`                                  Set a toggle button to the checked or unchecked state.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.ribbon.RibbonButtonBar.ActiveItem`                                    See :meth:`~wx.ribbon.RibbonButtonBar.GetActiveItem`
:attr:`~wx.ribbon.RibbonButtonBar.ButtonCount`                                   See :meth:`~wx.ribbon.RibbonButtonBar.GetButtonCount`
:attr:`~wx.ribbon.RibbonButtonBar.HoveredItem`                                   See :meth:`~wx.ribbon.RibbonButtonBar.GetHoveredItem`
:attr:`~wx.ribbon.RibbonButtonBar.ShowToolTipsForDisabled`                       See :meth:`~wx.ribbon.RibbonButtonBar.GetShowToolTipsForDisabled` and :meth:`~wx.ribbon.RibbonButtonBar.SetShowToolTipsForDisabled`
================================================================================ ================================================================================


|


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


.. class:: wx.ribbon.RibbonButtonBar(RibbonControl)

   **Possible constructors**::

       RibbonButtonBar()
       
       RibbonButtonBar(parent, id=ID_ANY, pos=DefaultPosition,
                       size=DefaultSize, style=0)
       
   
   A ribbon button bar is similar to a traditional toolbar.



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



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self)`
      
      Default constructor.                  
      
      With this constructor, :meth:`Create`   should be called in order to create the button bar.                   
      
      
      
      
      **~~~**

      
      **__init__** `(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0)`
      
      Construct a ribbon button bar with the given parameters.                  
      
      
      
      
      :param `parent`: Parent window for the button bar (typically a :ref:`wx.ribbon.RibbonPanel`).   
      :type `parent`: wx.Window
      :param `id`: An identifier for the button bar.  ``ID_ANY``   is taken to mean a default.    
      :type `id`: wx.WindowID
      :param `pos`: Initial position of the button bar.   
      :type `pos`: wx.Point
      :param `size`: Initial size of the button bar.   
      :type `size`: wx.Size
      :param `style`: Button bar style, currently unused.   
      :type `style`: long
      
      
      
      
      
      
      
      
      
      
      
      
                        
      
      
      
      
      **~~~**






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



      |overload| Overloaded Implementations:

      **~~~**

      
      **AddButton** `(self, button_id, label, bitmap, help_string, kind=RIBBON_BUTTON_NORMAL)`
      
      Add a button to the button bar (simple version).                  
      
      
      :param `button_id`: 
      :type `button_id`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `help_string`: 
      :type `help_string`: string
      :param `kind`: 
      :type `kind`: wx.ribbon.RibbonButtonKind
      
      
      
      
      :rtype: :ref:`RibbonButtonBarButtonBase`
      
      
      
      
      
      
      
      **~~~**

      
      **AddButton** `(self, button_id, label, bitmap, bitmap_small=NullBitmap, bitmap_disabled=NullBitmap, bitmap_small_disabled=NullBitmap, kind=RIBBON_BUTTON_NORMAL, help_string=EmptyString)`
      
      Add a button to the button bar.                  
      
      
      
      
      :param `button_id`: ``ID`` of the new button (used for event callbacks).   
      :type `button_id`: int
      :param `label`: Label of the new button.   
      :type `label`: string
      :param `bitmap`: Large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar.   
      :type `bitmap`: wx.Bitmap
      :param `bitmap_small`: Small bitmap of the new button. If left as null, then a small bitmap will be automatically generated. Must be the same size as all other small bitmaps used on the button bar.   
      :type `bitmap_small`: wx.Bitmap
      :param `bitmap_disabled`: Large bitmap of the new button when it is disabled. If left as null, then a bitmap will be automatically generated from  `bitmap`.   
      :type `bitmap_disabled`: wx.Bitmap
      :param `bitmap_small_disabled`: Small bitmap of the new button when it is disabled. If left as null, then a bitmap will be automatically generated from  `bitmap_small`.   
      :type `bitmap_small_disabled`: wx.Bitmap
      :param `kind`: The kind of button to add.   
      :type `kind`: wx.ribbon.RibbonButtonKind
      :param `help_string`: The UI help string to associate with the new button.  
      :type `help_string`: string
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      :rtype: :ref:`RibbonButtonBarButtonBase`
      
      
      
                        
      
      
      
      :returns: 
      
         An opaque pointer which can be used only with other button bar methods.  
      
      
      
      
      
      
      
      .. seealso:: :meth:`AddDropdownButton`     
      
      
      
      
      
      
      
      .. seealso:: :meth:`AddHybridButton`     
      
      
      
      
      
      
      
      .. seealso:: :meth:`AddToggleButton`     
      
      
      
      
      
      
      
      **~~~**






   .. method:: AddDropdownButton(self, button_id, label, bitmap, help_string=EmptyString)

      Add a dropdown button to the button bar (simple version).                  

                


      :param `button_id`: 
      :type `button_id`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `help_string`: 
      :type `help_string`: string




      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. seealso:: :meth:`AddButton`     








   .. method:: AddHybridButton(self, button_id, label, bitmap, help_string=EmptyString)

      Add a hybrid button to the button bar (simple version).                  

                


      :param `button_id`: 
      :type `button_id`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `help_string`: 
      :type `help_string`: string




      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. seealso:: :meth:`AddButton`     








   .. method:: AddToggleButton(self, button_id, label, bitmap, help_string=EmptyString)

      Add a toggle button to the button bar (simple version).                  

                


      :param `button_id`: 
      :type `button_id`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `help_string`: 
      :type `help_string`: string




      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. seealso:: :meth:`AddButton`     








   .. method:: ClearButtons(self)

      Delete all buttons from the button bar.                  

                 



      .. seealso:: :meth:`DeleteButton`     








   .. method:: Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0)

      Create a button bar in two-step button bar construction.                  

      Should only be called when the default constructor is used, and arguments have the same meaning as in the full constructor.                  


      :param `parent`: 
      :type `parent`: wx.Window
      :param `id`: 
      :type `id`: wx.WindowID
      :param `pos`: 
      :type `pos`: wx.Point
      :param `size`: 
      :type `size`: wx.Size
      :param `style`: 
      :type `style`: long




      :rtype: `bool`








   .. method:: DeleteButton(self, button_id)

      Delete a single button from the button bar.                  

                


      :param `button_id`: 
      :type `button_id`: int




      :rtype: `bool`







      .. seealso:: :meth:`ClearButtons`     








   .. method:: EnableButton(self, button_id, enable=True)

      Enable or disable a single button on the bar.                  




      :param `button_id`: ``ID`` of the button to enable or disable.   
      :type `button_id`: int
      :param `enable`: ``True`` to enable the button, ``False`` to disable it.   
      :type `enable`: bool






                  





   .. method:: GetActiveItem(self)

      Returns the active item of the button bar or ``None`` if there is none.                  

      The active button is the one being clicked. 

                

      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. versionadded:: 2.9.5 
     








   .. method:: GetButtonCount(self)

      Returns the number of buttons in this button bar.                  

                

      :rtype: `int`







      .. versionadded:: 2.9.4 
     








   .. method:: GetHoveredItem(self)

      Returns the hovered item of the button bar or ``None`` if there is none.                  

      The hovered button is the one the mouse is over. 

                

      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. versionadded:: 2.9.5 
     








   .. method:: GetItem(self, n)

      Returns the N-th button of the bar.                  

                


      :param `n`: 
      :type `n`: int




      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. versionadded:: 2.9.5 
     







      .. seealso:: :meth:`GetButtonCount`   








   .. method:: GetItemById(self, id)

      Returns the first button having a given id or ``None`` if none matches.                  

                


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




      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. versionadded:: 2.9.5 
     








   .. method:: GetItemClientData(self, item)

      Get the client object associated with a button.                  

                


      :param `item`: 
      :type `item`: RibbonButtonBarButtonBase




      :rtype: :ref:`ClientData`







      .. versionadded:: 2.9.5 
     








   .. method:: GetItemId(self, item)

      Returns the id of a button.                  

                


      :param `item`: 
      :type `item`: RibbonButtonBarButtonBase




      :rtype: `int`







      .. versionadded:: 2.9.5 
     








   .. method:: GetShowToolTipsForDisabled(self)

      Sets whether tooltips should be shown for disabled buttons or not.                  

      You may wish to show it to explain why a button is disabled or what it normally does when enabled. 

                

      :rtype: `bool`







      .. versionadded:: 2.9.5 
     








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



      |overload| Overloaded Implementations:

      **~~~**

      
      **InsertButton** `(self, pos, button_id, label, bitmap, help_string, kind=RIBBON_BUTTON_NORMAL)`
      
      Inserts a button to the button bar (simple version) at the given position.                  
      
                      
      
      
      :param `pos`: 
      :type `pos`: int
      :param `button_id`: 
      :type `button_id`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `help_string`: 
      :type `help_string`: string
      :param `kind`: 
      :type `kind`: wx.ribbon.RibbonButtonKind
      
      
      
      
      :rtype: :ref:`RibbonButtonBarButtonBase`
      
      
      
      
      
      
      
      .. versionadded:: 2.9.4 
           
      
      
      
      
      
      
      
      .. seealso:: :meth:`AddButton`   
      
      
      
      
      
      
      
      **~~~**

      
      **InsertButton** `(self, pos, button_id, label, bitmap, bitmap_small=NullBitmap, bitmap_disabled=NullBitmap, bitmap_small_disabled=NullBitmap, kind=RIBBON_BUTTON_NORMAL, help_string=EmptyString)`
      
      Insert a button to the button bar at the given position.                  
      
      
      
      
      :param `pos`: Position of the new button in the button bar.   
      :type `pos`: int
      :param `button_id`: ``ID`` of the new button (used for event callbacks).   
      :type `button_id`: int
      :param `label`: Label of the new button.   
      :type `label`: string
      :param `bitmap`: Large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar.   
      :type `bitmap`: wx.Bitmap
      :param `bitmap_small`: Small bitmap of the new button. If left as null, then a small bitmap will be automatically generated. Must be the same size as all other small bitmaps used on the button bar.   
      :type `bitmap_small`: wx.Bitmap
      :param `bitmap_disabled`: Large bitmap of the new button when it is disabled. If left as null, then a bitmap will be automatically generated from  `bitmap`.   
      :type `bitmap_disabled`: wx.Bitmap
      :param `bitmap_small_disabled`: Small bitmap of the new button when it is disabled. If left as null, then a bitmap will be automatically generated from  `bitmap_small`.   
      :type `bitmap_small_disabled`: wx.Bitmap
      :param `kind`: The kind of button to add.   
      :type `kind`: wx.ribbon.RibbonButtonKind
      :param `help_string`: The UI help string to associate with the new button.  
      :type `help_string`: string
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      :rtype: :ref:`RibbonButtonBarButtonBase`
      
      
      
                        
      
      
      
      :returns: 
      
         An opaque pointer which can be used only with other button bar methods.  
      
      
      
      
      
      
      
      .. versionadded:: 2.9.4 
           
      
      
      
      
      
      
      
      .. seealso:: :meth:`InsertDropdownButton`     
      
      
      
      
      
      
      
      .. seealso:: :meth:`InsertHybridButton`     
      
      
      
      
      
      
      
      .. seealso:: :meth:`InsertToggleButton`     
      
      
      
      
      
      
      
      .. seealso:: :meth:`AddButton`   
      
      
      
      
      
      
      
      **~~~**






   .. method:: InsertDropdownButton(self, pos, button_id, label, bitmap, help_string=EmptyString)

      Inserts a dropdown button to the button bar (simple version) at the given position.                  

                


      :param `pos`: 
      :type `pos`: int
      :param `button_id`: 
      :type `button_id`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `help_string`: 
      :type `help_string`: string




      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. versionadded:: 2.9.4 
     







      .. seealso:: :meth:`InsertButton`     







      .. seealso:: :meth:`AddDropdownButton`     







      .. seealso:: :meth:`AddButton`   








   .. method:: InsertHybridButton(self, pos, button_id, label, bitmap, help_string=EmptyString)

      Inserts a hybrid button to the button bar (simple version) at the given position.                  

                


      :param `pos`: 
      :type `pos`: int
      :param `button_id`: 
      :type `button_id`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `help_string`: 
      :type `help_string`: string




      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. versionadded:: 2.9.4 
     







      .. seealso:: :meth:`InsertButton`     







      .. seealso:: :meth:`AddHybridButton`     







      .. seealso:: :meth:`AddButton`   








   .. method:: InsertToggleButton(self, pos, button_id, label, bitmap, help_string=EmptyString)

      Inserts a toggle button to the button bar (simple version) at the given position.                  

                


      :param `pos`: 
      :type `pos`: int
      :param `button_id`: 
      :type `button_id`: int
      :param `label`: 
      :type `label`: string
      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap
      :param `help_string`: 
      :type `help_string`: string




      :rtype: :ref:`RibbonButtonBarButtonBase`







      .. versionadded:: 2.9.4 
     







      .. seealso:: :meth:`InsertButton`     







      .. seealso:: :meth:`AddToggleButton`     







      .. seealso:: :meth:`AddButton`   








   .. method:: Realize(self)

      Calculate button layouts and positions.                  

      Must be called after buttons are added to the button bar, as otherwise the newly added buttons will not be displayed. In normal situations, it will be called automatically when :meth:`wx.ribbon.RibbonBar.Realize`   is called.                  

      :rtype: `bool`








   .. method:: SetItemClientData(self, item, data)

      Set the client object associated with a button.                  

      The button bar owns the given object and takes care of its deletion. Please, note that you cannot use both client object and client data. 

                


      :param `item`: 
      :type `item`: RibbonButtonBarButtonBase
      :param `data`: 
      :type `data`: ClientData






      .. versionadded:: 2.9.5 
     








   .. method:: SetShowToolTipsForDisabled(self, show)

      Indicates whether tooltips are shown for disabled buttons.                  

      By default they are not shown. 

                


      :param `show`: 
      :type `show`: bool






      .. versionadded:: 2.9.5 
     








   .. method:: ToggleButton(self, button_id, checked)

      Set a toggle button to the checked or unchecked state.                  




      :param `button_id`: ``ID`` of the toggle button to manipulate.   
      :type `button_id`: int
      :param `checked`: ``True`` to set the button to the toggled/pressed/checked state, ``False`` to set it to the untoggled/unpressed/unchecked state.   
      :type `checked`: bool






                  





   .. attribute:: ActiveItem

      See :meth:`~wx.ribbon.RibbonButtonBar.GetActiveItem`


   .. attribute:: ButtonCount

      See :meth:`~wx.ribbon.RibbonButtonBar.GetButtonCount`


   .. attribute:: HoveredItem

      See :meth:`~wx.ribbon.RibbonButtonBar.GetHoveredItem`


   .. attribute:: ShowToolTipsForDisabled

      See :meth:`~wx.ribbon.RibbonButtonBar.GetShowToolTipsForDisabled` and :meth:`~wx.ribbon.RibbonButtonBar.SetShowToolTipsForDisabled`

