.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.lib.agw.ribbon.toolbar .. highlight:: python .. _wx.lib.agw.ribbon.toolbar.RibbonToolBar: ========================================================================================================================================== |phoenix_title| **wx.lib.agw.ribbon.toolbar.RibbonToolBar** ========================================================================================================================================== Base class for all the Ribbon stuff. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class RibbonToolBar:
| |appearance| Control Appearance =============================== | .. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.ribbon.toolbar.ribbontoolbar.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: _static/images/widgets/fullsize/wxgtk/wx.lib.agw.ribbon.toolbar.ribbontoolbar.png :alt: wxGTK :figclass: floatcenter **wxGTK** | |super_classes| Known Superclasses ================================== :class:`wx.lib.agw.ribbon.control.RibbonControl` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.__init__` Default class constructor. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.AddDropdownTool` Add a dropdown tool to the tool bar (simple version). :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.AddHybridTool` Add a hybrid tool to the tool bar (simple version). :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.AddSeparator` Adds a separator to the tool bar. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.AddSimpleTool` Add a tool to the tool bar (simple version). :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.AddToggleTool` Add a toggle tool to the tool bar (simple version). :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.AddTool` Add a tool to the tool bar. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.AppendGroup` :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.ClearTools` Deletes all the tools in the toolbar. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.CommonInit` :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.DeleteTool` Removes the specified tool from the toolbar and deletes it. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.DeleteToolByPos` This function behaves like :meth:`~RibbonToolBar.DeleteTool` but it deletes the tool at the :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.DoGetBestSize` Gets the size which best suits the window: for a control, it would be the :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.DoGetNextLargerSize` Implementation of :meth:`RibbonControl.GetNextLargerSize() `. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.DoGetNextSmallerSize` Implementation of :meth:`RibbonControl.GetNextSmallerSize() `. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.EnableTool` Enables or disables a single tool on the bar. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.FindById` Returns a pointer to the tool opaque structure by `tool_id` or ``None`` if :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetBestSizeForParentSize` Finds the best width and height given the parent's width and height. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetDefaultBorder` Returns the default border style for :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetToolByPos` Returns a pointer to the tool opaque structure by `pos` or ``None`` if :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetToolClientData` Get any client data associated with the tool. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetToolCount` Returns the number of tools in this :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetToolEnabled` Called to determine whether a tool is enabled (responds to user input). :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetToolHelpString` Returns the tool short help string. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetToolId` Returns the tool id for the specified input `tool`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetToolKind` Returns the kind of the given tool. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetToolPos` Returns the tool position in the toolbar, or ``wx.NOT_FOUND`` if the tool is not found. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.GetToolState` Gets the on/off state of a toggle tool. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.InsertDropdownTool` Inserts a dropdown tool in the tool bar at the position specified by `pos`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.InsertGroup` :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.InsertHybridTool` Inserts a hybrid tool in the tool bar at the position specified by `pos`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.InsertSeparator` Inserts a separator into the tool bar at the position specified by `pos`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.InsertToggleTool` Inserts a toggle tool in the tool bar at the position specified by `pos`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.InsertTool` Inserts a tool in the tool bar at the position specified by `pos`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.IsSizingContinuous` Returns ``True`` if this window can take any size (greater than its minimum size), :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.MakeDisabledBitmap` :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.OnEraseBackground` Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.OnMouseDown` Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.OnMouseEnter` Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.OnMouseLeave` Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.OnMouseMove` Handles the ``wx.EVT_MOTION`` event for :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.OnMouseUp` Handles the ``wx.EVT_LEFT_UP`` event for :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.OnSize` Handles the ``wx.EVT_SIZE`` event for :class:`RibbonToolBar`. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.Realize` Calculates tool layouts and positions. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.SetRows` Set the number of rows to distribute tool groups over. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.SetToolClientData` Sets the client data associated with the tool. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.SetToolDisabledBitmap` Sets the bitmap to be used by the tool with the given ID when the tool is in a disabled state. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.SetToolHelpString` Sets the tool short help string. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.SetToolNormalBitmap` Sets the bitmap to be used by the tool with the given ID when the tool is enabled. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.ToggleTool` Toggles on or off a single tool on the bar. :meth:`~wx.lib.agw.ribbon.toolbar.RibbonToolBar.UpdateWindowUI` This function sends one or more :class:`UpdateUIEvent` to the window. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: RibbonToolBar(RibbonControl) Base class for all the Ribbon stuff. .. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name="RibbonToolBar") Default class constructor. :param `parent`: pointer to a parent window, typically a :class:`~wx.lib.agw.ribbon.panel.RibbonPanel`; :param `id`: window identifier. If ``wx.ID_ANY``, will automatically create an identifier; :param `pos`: window position. ``wx.DefaultPosition`` indicates that wxPython should generate a default position for the window; :param `size`: window size. ``wx.DefaultSize`` indicates that wxPython should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized; :param `style`: window style, currently unused. :param `name`: the window name. .. method:: AddDropdownTool(self, tool_id, bitmap, help_string="") Add a dropdown tool to the tool bar (simple version). :param `tool_id`: id of the new tool (used for event callbacks); :param `bitmap`: large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar; :param `help_string`: the UI help string to associate with the new button. .. seealso:: :meth:`~RibbonToolBar.AddTool` .. method:: AddHybridTool(self, tool_id, bitmap, help_string="") Add a hybrid tool to the tool bar (simple version). :param `tool_id`: id of the new tool (used for event callbacks); :param `bitmap`: large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar; :param `help_string`: the UI help string to associate with the new button. .. seealso:: :meth:`~RibbonToolBar.AddTool` .. method:: AddSeparator(self) Adds a separator to the tool bar. Separators are used to separate tools into groups. As such, a separator is not explicitly drawn, but is visually seen as the gap between tool groups. .. method:: AddSimpleTool(self, tool_id, bitmap, help_string, kind=RIBBON_BUTTON_NORMAL) Add a tool to the tool bar (simple version). :param `tool_id`: id of the new tool (used for event callbacks); :param `bitmap`: large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar; :param `help_string`: the UI help string to associate with the new button; :param `kind`: the kind of button to add. .. seealso:: :meth:`~RibbonToolBar.AddDropdownTool`, :meth:`~RibbonToolBar.AddHybridTool`, :meth:`~RibbonToolBar.AddTool` .. method:: AddToggleTool(self, tool_id, bitmap, help_string="") Add a toggle tool to the tool bar (simple version). :param `tool_id`: id of the new tool (used for event callbacks); :param `bitmap`: large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar; :param `help_string`: the UI help string to associate with the new button. .. seealso:: :meth:`~RibbonToolBar.AddTool` .. method:: AddTool(self, tool_id, bitmap, bitmap_disabled=wx.NullBitmap, help_string="", kind=RIBBON_BUTTON_NORMAL, client_data=None) Add a tool to the tool bar. :param `tool_id`: id of the new tool (used for event callbacks); :param `bitmap`: bitmap to use as the foreground for the new tool. Does not have to be the same size as other tool bitmaps, but should be similar as otherwise it will look visually odd; :param `bitmap_disabled`: bitmap to use when the tool is disabled. If left as :class:`NullBitmap`, then a bitmap will be automatically generated from `bitmap`; :param `help_string`: the UI help string to associate with the new tool; :param `kind`: the kind of tool to add; :param `client_data`: client data to associate with the new tool. :returns: An opaque pointer which can be used only with other tool bar methods. .. seealso:: :meth:`~RibbonToolBar.AddDropdownTool`, :meth:`~RibbonToolBar.AddHybridTool`, :meth:`~RibbonToolBar.AddSeparator` .. method:: AppendGroup(self) .. method:: ClearTools(self) Deletes all the tools in the toolbar. .. versionadded:: 0.9.5 .. method:: CommonInit(self, style) .. method:: DeleteTool(self, tool_id) Removes the specified tool from the toolbar and deletes it. :param `tool_id`: id of the tool to delete. :returns: ``True`` if the tool was deleted, ``False`` otherwise. .. seealso:: :meth:`~RibbonToolBar.DeleteToolByPos` .. versionadded:: 0.9.5 .. method:: DeleteToolByPos(self, pos) This function behaves like :meth:`~RibbonToolBar.DeleteTool` but it deletes the tool at the specified position `pos` and not the one with the given id. Useful to delete separators. :param `pos`: zero-based position of the tool to delete. :returns: ``True`` if the tool was deleted, ``False`` otherwise. .. seealso:: :meth:`~RibbonToolBar.DeleteTool` .. versionadded:: 0.9.5 .. method:: DoGetBestSize(self) Gets the size which best suits the window: for a control, it would be the minimal size which doesn't truncate the control, for a panel - the same size as it would have after a call to `Fit()`. :return: An instance of :class:`wx.Size`. .. note:: Overridden from :class:`wx.Control`. .. method:: DoGetNextLargerSize(self, direction, relative_to) Implementation of :meth:`RibbonControl.GetNextLargerSize() `. Controls which have non-continuous sizing must override this virtual function rather than :meth:`RibbonControl.GetNextLargerSize() `. .. method:: DoGetNextSmallerSize(self, direction, relative_to) Implementation of :meth:`RibbonControl.GetNextSmallerSize() `. Controls which have non-continuous sizing must override this virtual function rather than :meth:`RibbonControl.GetNextSmallerSize() `. .. method:: EnableTool(self, tool_id, enable=True) Enables or disables a single tool on the bar. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`; :param `enable`: ``True`` to enable the tool, ``False`` to disable it. .. versionadded:: 0.9.5 .. method:: FindById(self, tool_id) Returns a pointer to the tool opaque structure by `tool_id` or ``None`` if no corresponding tool is found. :param `tool_id`: id of the tool to find. .. versionadded:: 0.9.5 .. method:: GetBestSizeForParentSize(self, parentSize) Finds the best width and height given the parent's width and height. .. method:: GetDefaultBorder(self) Returns the default border style for :class:`RibbonToolBar`. .. method:: GetToolByPos(self, pos) Returns a pointer to the tool opaque structure by `pos` or ``None`` if no corresponding tool is found. :param `pos`: zero-based position of the tool to retrieve. :returns: An instance of :class:`RibbonToolBarToolBase` if the tool was found, ``None`` if it was not found. .. versionadded:: 0.9.5 .. method:: GetToolClientData(self, tool_id) Get any client data associated with the tool. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`. :return: Client data (any Python object), or ``None`` if there is none. .. versionadded:: 0.9.5 .. method:: GetToolCount(self) Returns the number of tools in this :class:`RibbonToolBar`. .. versionadded:: 0.9.5 .. method:: GetToolEnabled(self, tool_id) Called to determine whether a tool is enabled (responds to user input). :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`. :return: ``True`` if the tool was found and it is enabled, ``False`` otherwise. .. versionadded:: 0.9.5 .. method:: GetToolHelpString(self, tool_id) Returns the tool short help string. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`. .. versionadded:: 0.9.5 .. method:: GetToolId(self, tool) Returns the tool id for the specified input `tool`. :param `tool`: an instance of :class:`RibbonToolBarToolBase`. .. versionadded:: 0.9.5 .. method:: GetToolKind(self, tool_id) Returns the kind of the given tool. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`. .. versionadded:: 0.9.5 .. method:: GetToolPos(self, tool_id) Returns the tool position in the toolbar, or ``wx.NOT_FOUND`` if the tool is not found. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`. .. versionadded:: 0.9.5 .. method:: GetToolState(self, tool_id) Gets the on/off state of a toggle tool. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`. :return: ``True`` if the tool is toggled on, ``False`` otherwise. .. seealso:: :meth:`~RibbonToolBar.ToggleTool` .. versionadded:: 0.9.5 .. method:: InsertDropdownTool(self, pos, tool_id, bitmap, help_string="") Inserts a dropdown tool in the tool bar at the position specified by `pos`. :param `pos`: the position of the new tool in the toolbar (zero-based); :param `tool_id`: id of the new tool (used for event callbacks); :param `bitmap`: large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar; :param `help_string`: the UI help string to associate with the new button. .. seealso:: :meth:`~RibbonToolBar.AddTool`, :meth:`~RibbonToolBar.InsertTool` .. versionadded:: 0.9.5 .. method:: InsertGroup(self, pos) .. method:: InsertHybridTool(self, pos, tool_id, bitmap, help_string="") Inserts a hybrid tool in the tool bar at the position specified by `pos`. :param `pos`: the position of the new tool in the toolbar (zero-based); :param `tool_id`: id of the new tool (used for event callbacks); :param `bitmap`: large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar; :param `help_string`: the UI help string to associate with the new button. .. seealso:: :meth:`~RibbonToolBar.AddTool`, :meth:`~RibbonToolBar.InsertTool` .. versionadded:: 0.9.5 .. method:: InsertSeparator(self, pos) Inserts a separator into the tool bar at the position specified by `pos`. Separators are used to separate tools into groups. As such, a separator is not explicitly drawn, but is visually seen as the gap between tool groups. :param `pos`: the position of the new tool in the toolbar (zero-based). .. versionadded:: 0.9.5 .. method:: InsertToggleTool(self, pos, tool_id, bitmap, help_string="") Inserts a toggle tool in the tool bar at the position specified by `pos`. :param `pos`: the position of the new tool in the toolbar (zero-based); :param `tool_id`: id of the new tool (used for event callbacks); :param `bitmap`: large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar; :param `help_string`: the UI help string to associate with the new button. .. seealso:: :meth:`~RibbonToolBar.AddTool`, :meth:`~RibbonToolBar.InsertTool` .. versionadded:: 0.9.5 .. method:: InsertTool(self, pos, tool_id, bitmap, bitmap_disabled=wx.NullBitmap, help_string="", kind=RIBBON_BUTTON_NORMAL, client_data=None) Inserts a tool in the tool bar at the position specified by `pos`. :param `pos`: the position of the new tool in the toolbar (zero-based); :param `tool_id`: id of the new tool (used for event callbacks); :param `bitmap`: bitmap to use as the foreground for the new tool. Does not have to be the same size as other tool bitmaps, but should be similar as otherwise it will look visually odd; :param `bitmap_disabled`: bitmap to use when the tool is disabled. If left as :class:`NullBitmap`, then a bitmap will be automatically generated from `bitmap`; :param `help_string`: the UI help string to associate with the new tool; :param `kind`: the kind of tool to add; :param `client_data`: client data to associate with the new tool. :returns: An opaque pointer which can be used only with other tool bar methods. .. seealso:: :meth:`~RibbonToolBar.AddTool`, :meth:`~RibbonToolBar.AddDropdownTool`, :meth:`~RibbonToolBar.AddHybridTool`, :meth:`~RibbonToolBar.AddSeparator` .. versionadded:: 0.9.5 .. method:: IsSizingContinuous(self) Returns ``True`` if this window can take any size (greater than its minimum size), ``False`` if it can only take certain sizes. .. seealso:: :meth:`RibbonControl.GetNextSmallerSize() `, :meth:`RibbonControl.GetNextLargerSize() ` .. method:: MakeDisabledBitmap(self, original) .. method:: OnEraseBackground(self, event) Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`RibbonToolBar`. :param `event`: a :class:`EraseEvent` event to be processed. .. method:: OnMouseDown(self, event) Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`RibbonToolBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseEnter(self, event) Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`RibbonToolBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseLeave(self, event) Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`RibbonToolBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseMove(self, event) Handles the ``wx.EVT_MOTION`` event for :class:`RibbonToolBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseUp(self, event) Handles the ``wx.EVT_LEFT_UP`` event for :class:`RibbonToolBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnPaint(self, event) Handles the ``wx.EVT_PAINT`` event for :class:`RibbonToolBar`. :param `event`: a :class:`PaintEvent` event to be processed. .. method:: OnSize(self, event) Handles the ``wx.EVT_SIZE`` event for :class:`RibbonToolBar`. :param `event`: a :class:`wx.SizeEvent` event to be processed. .. method:: Realize(self) Calculates tool layouts and positions. Must be called after tools are added to the tool bar, as otherwise the newly added tools will not be displayed. .. note:: Reimplemented from :class:`~wx.lib.agw.ribbon.control.RibbonControl`. .. method:: SetRows(self, nMin, nMax) Set the number of rows to distribute tool groups over. Tool groups can be distributed over a variable number of rows. The way in which groups are assigned to rows is not specified, and the order of groups may change, but they will be distributed in such a way as to minimise the overall size of the tool bar. :param `nMin`: the minimum number of rows to use; :param `nMax`: the maximum number of rows to use (defaults to `nMin`). .. method:: SetToolClientData(self, tool_id, clientData) Sets the client data associated with the tool. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`; :param `clientData`: any Python object. .. versionadded:: 0.9.5 .. method:: SetToolDisabledBitmap(self, tool_id, bitmap) Sets the bitmap to be used by the tool with the given ID when the tool is in a disabled state. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`; :param `bitmap`: an instance of :class:`wx.Bitmap`. .. versionadded:: 0.9.5 .. method:: SetToolHelpString(self, tool_id, helpString) Sets the tool short help string. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`; :param `helpString`: a string for the help. .. versionadded:: 0.9.5 .. method:: SetToolNormalBitmap(self, tool_id, bitmap) Sets the bitmap to be used by the tool with the given ID when the tool is enabled. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`; :param `bitmap`: an instance of :class:`wx.Bitmap`. .. versionadded:: 0.9.5 .. method:: ToggleTool(self, tool_id, checked=True) Toggles on or off a single tool on the bar. :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`; :param `checked`: ``True`` to toggle on the tool, ``False`` to toggle it off. .. versionadded:: 0.9.5 .. method:: UpdateWindowUI(self, flags) This function sends one or more :class:`UpdateUIEvent` to the window. The particular implementation depends on the window; for example a :class:`ToolBar` will send an update UI event for each toolbar button, and a :class:`wx.Frame` will send an update UI event for each menubar menu item. You can call this function from your application to ensure that your UI is up-to-date at this point (as far as your :class:`UpdateUIEvent` handlers are concerned). This may be necessary if you have called :meth:`UpdateUIEvent.SetMode` or :meth:`UpdateUIEvent.SetUpdateInterval` to limit the overhead that wxWidgets incurs by sending update UI events in idle time. :param integer `flags`: should be a bitlist of one or more of ``wx.UPDATE_UI_NONE``, ``wx.UPDATE_UI_RECURSE`` or ``wx.UPDATE_UI_FROMIDLE``. If you are calling this function from an `OnInternalIdle` or `OnIdle` function, make sure you pass the ``wx.UPDATE_UI_FROMIDLE`` flag, since this tells the window to only update the UI elements that need to be updated in idle time. Some windows update their elements only when necessary, for example when a menu is about to be shown. The following is an example of how to call :meth:`~RibbonToolBar.UpdateWindowUI` from an idle function:: def OnInternalIdle(self): if wx.UpdateUIEvent.CanUpdate(self): self.UpdateWindowUI(wx.UPDATE_UI_FROMIDLE) .. versionadded:: 0.9.5