.. 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.buttonbar .. highlight:: python .. _wx.lib.agw.ribbon.buttonbar.RibbonButtonBar: ========================================================================================================================================== |phoenix_title| **wx.lib.agw.ribbon.buttonbar.RibbonButtonBar** ========================================================================================================================================== A ribbon button bar is similar to a traditional toolbar. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class RibbonButtonBar:
| |appearance| Control Appearance =============================== | .. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.ribbon.buttonbar.ribbonbuttonbar.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.buttonbar.ribbonbuttonbar.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.buttonbar.RibbonButtonBar.__init__` Default class constructor. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.AddButton` Add a button to the button bar. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.AddDropdownButton` Add a dropdown button to the button bar (simple version). :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.AddHybridButton` Add a hybrid button to the button bar (simple version). :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.AddSimpleButton` Add a button to the button bar (simple version). :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.AddToggleButton` Add a toggle button to the button bar. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.ClearButtons` Delete all buttons from the button bar. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.CommonInit` Common initialization procedures. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.DeleteButton` Delete a single button from the button bar. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.DoGetBestSize` Gets the size which best suits the window: for a control, it would be the :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.DoGetNextLargerSize` Implementation of :meth:`RibbonControl.GetNextLargerSize() `. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.DoGetNextSmallerSize` Implementation of :meth:`RibbonControl.GetNextSmallerSize() `. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.EnableButton` Enable or disable a single button on the bar. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.FetchButtonSizeInfo` :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.GetButtonCount` Returns the number of buttons in this :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.GetDefaultBorder` Returns the default border style for :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.GetMinSize` Returns the minimum size of the window, an indication to the sizer layout mechanism :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.InsertButton` Inserts a button in the button bar at the position specified by `pos`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.InsertDropdownButton` Inserts a dropdown button in the button bar at the position specified by `pos`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.InsertHybridButton` Inserts a hybrid button in the button bar at the position specified by `pos`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.InsertToggleButton` Inserts a toggle button in the button bar at the position specified by `pos`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.IsButtonEnabled` Returns whether a button in the bar is enabled or not. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.IsSizingContinuous` Returns ``True`` if this window can take any size (greater than its minimum size), :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.MakeDisabledBitmap` Converts the `original` bitmap into a visually-looking disabled one. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.MakeLayouts` :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.MakeResizedBitmap` Resize and scale the `original` bitmap to the dimensions specified in `size`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.OnEraseBackground` Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.OnMouseDown` Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.OnMouseEnter` Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.OnMouseLeave` Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.OnMouseMove` Handles the ``wx.EVT_MOTION`` event for :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.OnMouseUp` Handles the ``wx.EVT_LEFT_UP`` event for :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.OnSize` Handles the ``wx.EVT_SIZE`` event for :class:`RibbonButtonBar`. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.Realize` Calculate button layouts and positions. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.SetArtProvider` Set the art provider to be used. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.ToggleButton` Toggles/untoggles a :class:`RibbonButtonBar` toggle button. :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.TryCollapseLayout` :meth:`~wx.lib.agw.ribbon.buttonbar.RibbonButtonBar.UpdateWindowUI` This function sends one or more :class:`UpdateUIEvent` to the window. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: RibbonButtonBar(RibbonControl) A ribbon button bar is similar to a traditional toolbar. .. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, agwStyle=0) Default class constructor. :param `parent`: pointer to a parent window, typically a :class:`~wx.lib.agw.ribbon.panel.RibbonPanel`; :type `parent`: :class:`wx.Window` :param integer `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; :type `pos`: tuple or :class:`wx.Point` :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; :type `size`: tuple or :class:`wx.Size` :param integer `agwStyle`: the AGW-specific window style, currently unused. .. method:: AddButton(self, button_id, label, bitmap, bitmap_small=wx.NullBitmap, bitmap_disabled=wx.NullBitmap, bitmap_small_disabled=wx.NullBitmap, kind=RIBBON_BUTTON_NORMAL, help_string="", client_data=None) Add a button to the button bar. :param integer `button_id`: id of the new button (used for event callbacks); :param string `label`: label of the new button; :param `bitmap`: large bitmap of the new button, an instance of :class:`wx.Bitmap`. Must be the same size as all other large bitmaps used on the button bar; :param `bitmap_small`: small bitmap of the new button, an instance of :class:`wx.Bitmap`. If left as :class:`NullBitmap`, then a small bitmap will be automatically generated. Must be the same size as all other small bitmaps used on the button bar; :param `bitmap_disabled`: large bitmap of the new button when it is disabled, an instance of :class:`wx.Bitmap`. If left as :class:`NullBitmap`, then a bitmap will be automatically generated from `bitmap`; :param `bitmap_small_disabled`: small bitmap of the new button when it is disabled, an instance of :class:`wx.Bitmap`. If left as :class:`NullBitmap`, then a bitmap will be automatically generated from `bitmap_small`; :param integer `kind`: the kind of button to add, one of the following values: ========================================== =========== ========================================== Button Kind Hex Value Description ========================================== =========== ========================================== ``RIBBON_BUTTON_NORMAL`` 0x1 Normal button or tool with a clickable area which causes some generic action. ``RIBBON_BUTTON_DROPDOWN`` 0x2 Dropdown button or tool with a clickable area which typically causes a dropdown menu. ``RIBBON_BUTTON_HYBRID`` 0x3 Button or tool with two clickable areas - one which causes a dropdown menu, and one which causes a generic action. ``RIBBON_BUTTON_TOGGLE`` 0x4 Normal button or tool with a clickable area which toggles the button between a pressed and unpressed state. ========================================== =========== ========================================== :param string `help_string`: the UI help string to associate with the new button; :param object `client_data`: client data to associate with the new button (any Python object). :returns: An opaque pointer which can be used only with other button bar methods. .. seealso:: :meth:`~RibbonButtonBar.InsertButton`, :meth:`~RibbonButtonBar.AddDropdownButton`, :meth:`~RibbonButtonBar.AddHybridButton` .. method:: AddDropdownButton(self, button_id, label, bitmap, help_string="") Add a dropdown button to the button bar (simple version). :param integer `button_id`: id of the new button (used for event callbacks); :param string `label`: label of the new button; :param `bitmap`: large bitmap of the new button, an instance of :class:`wx.Bitmap`. Must be the same size as all other large bitmaps used on the button bar; :param string `help_string`: the UI help string to associate with the new button. :returns: An opaque pointer which can be used only with other button bar methods. .. seealso:: :meth:`~RibbonButtonBar.AddButton`, :meth:`~RibbonButtonBar.InsertDropdownButton`, :meth:`~RibbonButtonBar.InsertButton` .. method:: AddHybridButton(self, button_id, label, bitmap, help_string="") Add a hybrid button to the button bar (simple version). :param integer `button_id`: id of the new button (used for event callbacks); :param string `label`: label of the new button; :param `bitmap`: large bitmap of the new button, an instance of :class:`wx.Bitmap`. Must be the same size as all other large bitmaps used on the button bar; :param string `help_string`: the UI help string to associate with the new button. :returns: An opaque pointer which can be used only with other button bar methods. .. seealso:: :meth:`~RibbonButtonBar.AddButton`, :meth:`~RibbonButtonBar.InsertButton`, :meth:`~RibbonButtonBar.InsertHybridButton` .. method:: AddSimpleButton(self, button_id, label, bitmap, help_string, kind=RIBBON_BUTTON_NORMAL) Add a button to the button bar (simple version). :param integer `button_id`: id of the new button (used for event callbacks); :param string `label`: label of the new button; :param `bitmap`: large bitmap of the new button, an instance of :class:`wx.Bitmap`. Must be the same size as all other large bitmaps used on the button bar; :param string `help_string`: the UI help string to associate with the new button; :param integer `kind`: the kind of button to add. :returns: An opaque pointer which can be used only with other button bar methods. .. seealso:: :meth:`~RibbonButtonBar.AddButton` for a list of valid button `kind` values. .. method:: AddToggleButton(self, button_id, label, bitmap, help_string="") Add a toggle button to the button bar. :param integer `button_id`: id of the new button (used for event callbacks); :param string `label`: label of the new button; :param `bitmap`: large bitmap of the new button, an instance of :class:`wx.Bitmap`. Must be the same size as all other large bitmaps used on the button bar; :param string `help_string`: the UI help string to associate with the new button. :returns: An opaque pointer which can be used only with other button bar methods. .. seealso:: :meth:`~RibbonButtonBar.AddButton`, :meth:`~RibbonButtonBar.InsertButton`, :meth:`~RibbonButtonBar.InsertToggleButton` .. method:: ClearButtons(self) Delete all buttons from the button bar. .. seealso:: :meth:`~RibbonButtonBar.DeleteButton` .. method:: CommonInit(self, agwStyle) Common initialization procedures. :param integer `agwStyle`: the AGW-specific window style, currently unused. .. method:: DeleteButton(self, button_id) Delete a single button from the button bar. :param integer `button_id`: id of the button to delete. :return: ``True`` if the button has been found and successfully deleted, ``False`` otherwise. .. seealso:: :meth:`~RibbonButtonBar.ClearButtons` .. 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, _result) Implementation of :meth:`RibbonControl.GetNextLargerSize() `. Controls which have non-continuous sizing must override this virtual function rather than :meth:`RibbonControl.GetNextLargerSize() `. :return: An instance of :class:`wx.Size`. .. method:: DoGetNextSmallerSize(self, direction, _result) Implementation of :meth:`RibbonControl.GetNextSmallerSize() `. Controls which have non-continuous sizing must override this virtual function rather than :meth:`RibbonControl.GetNextSmallerSize() `. :return: An instance of :class:`wx.Size`. .. method:: EnableButton(self, button_id, enable=True) Enable or disable a single button on the bar. :param integer `button_id`: id of the button to enable or disable; :param bool `enable`: ``True`` to enable the button, ``False`` to disable it. :raise: `Exception` when the input `button_id` could not be associated with a :class:`RibbonButtonBar` button. .. method:: FetchButtonSizeInfo(self, button, size, dc) .. method:: GetButtonCount(self) Returns the number of buttons in this :class:`RibbonButtonBar`. .. versionadded:: 0.9.5 .. method:: GetDefaultBorder(self) Returns the default border style for :class:`RibbonButtonBar`. .. method:: GetMinSize(self) Returns the minimum size of the window, an indication to the sizer layout mechanism that this is the minimum required size. This method normally just returns the value set by `SetMinSize`, but it can be overridden to do the calculation on demand. :return: An instance of :class:`wx.Size`. .. method:: InsertButton(self, pos, button_id, label, bitmap, bitmap_small=wx.NullBitmap, bitmap_disabled=wx.NullBitmap, bitmap_small_disabled=wx.NullBitmap, kind=RIBBON_BUTTON_NORMAL, help_string="", client_data=None) Inserts a button in the button bar at the position specified by `pos`. :param integer `pos`: the position at which the new button must be inserted (zero-based); :param integer `button_id`: id of the new button (used for event callbacks); :param string `label`: label of the new button; :param `bitmap`: large bitmap of the new button, an instance of :class:`wx.Bitmap`. Must be the same size as all other large bitmaps used on the button bar; :param `bitmap_small`: small bitmap of the new button, an instance of :class:`wx.Bitmap`. If left as :class:`NullBitmap`, then a small bitmap will be automatically generated. Must be the same size as all other small bitmaps used on the button bar; :param `bitmap_disabled`: large bitmap of the new button when it is disabled, an instance of :class:`wx.Bitmap`. If left as :class:`NullBitmap`, then a bitmap will be automatically generated from `bitmap`; :param `bitmap_small_disabled`: small bitmap of the new button when it is disabled, an instance of :class:`wx.Bitmap`. If left as :class:`NullBitmap`, then a bitmap will be automatically generated from `bitmap_small`; :param integer `kind`: the kind of button to add; :param string `help_string`: the UI help string to associate with the new button; :param object `client_data`: client data to associate with the new button. :returns: An opaque pointer which can be used only with other button bar methods. :raise: `Exception` if both `bitmap` and `bitmap_small` are invalid or if the input `help_string` is not a valid Python `basestring`. .. seealso:: :meth:`~RibbonButtonBar.AddDropdownButton`, :meth:`~RibbonButtonBar.AddHybridButton` and :meth:`~RibbonButtonBar.AddButton` for a list of valid button `kind` values. .. versionadded:: 0.9.5 .. method:: InsertDropdownButton(self, pos, button_id, label, bitmap, help_string="") Inserts a dropdown button in the button bar at the position specified by `pos`. :param integer `pos`: the position at which the new button must be inserted (zero-based); :param integer `button_id`: id of the new button (used for event callbacks); :param string `label`: label of the new button; :param `bitmap`: large bitmap of the new button, an instance of :class:`wx.Bitmap`. Must be the same size as all other large bitmaps used on the button bar; :param string `help_string`: the UI help string to associate with the new button. :returns: An opaque pointer which can be used only with other button bar methods. .. seealso:: :meth:`~RibbonButtonBar.AddButton`, :meth:`~RibbonButtonBar.InsertButton`, :meth:`~RibbonButtonBar.AddDropdownButton` .. versionadded:: 0.9.5 .. method:: InsertHybridButton(self, pos, button_id, label, bitmap, help_string="") Inserts a hybrid button in the button bar at the position specified by `pos`. :param integer `pos`: the position at which the new button must be inserted (zero-based); :param integer `button_id`: id of the new button (used for event callbacks); :param string `label`: label of the new button; :param `bitmap`: large bitmap of the new button, an instance of :class:`wx.Bitmap`. Must be the same size as all other large bitmaps used on the button bar; :param string `help_string`: the UI help string to associate with the new button. :returns: An opaque pointer which can be used only with other button bar methods. .. seealso:: :meth:`~RibbonButtonBar.AddButton`, :meth:`~RibbonButtonBar.InsertButton`, :meth:`~RibbonButtonBar.AddHybridButton` .. versionadded:: 0.9.5 .. method:: InsertToggleButton(self, pos, button_id, label, bitmap, help_string="") Inserts a toggle button in the button bar at the position specified by `pos`. :param integer `pos`: the position at which the new button must be inserted (zero-based); :param integer `button_id`: id of the new button (used for event callbacks); :param string `label`: label of the new button; :param `bitmap`: large bitmap of the new button, an instance of :class:`wx.Bitmap`. Must be the same size as all other large bitmaps used on the button bar; :param string `help_string`: the UI help string to associate with the new button. :returns: An opaque pointer which can be used only with other button bar methods. .. seealso:: :meth:`~RibbonButtonBar.AddButton`, :meth:`~RibbonButtonBar.InsertButton`, :meth:`~RibbonButtonBar.AddToggleButton` .. versionadded:: 0.9.5 .. method:: IsButtonEnabled(self, button_id) Returns whether a button in the bar is enabled or not. :param integer `button_id`: id of the button to check. :return: ``True`` if the button is enabled, ``False`` otherwise. :raise: `Exception` when the input `button_id` could not be associated with a :class:`RibbonButtonBar` button. .. 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) Converts the `original` bitmap into a visually-looking disabled one. :param `original`: the original bitmap, an instance of :class:`wx.Bitmap`. :return: A visually-looking disabled representation of the input bitmap. .. method:: MakeLayouts(self) .. method:: MakeResizedBitmap(self, original, size) Resize and scale the `original` bitmap to the dimensions specified in `size`. :param `original`: the original bitmap, an instance of :class:`wx.Bitmap`; :param `size`: the size to which the input bitmap must be rescaled, an instance of :class:`wx.Size`. :return: A scaled representation of the input bitmap. .. method:: OnEraseBackground(self, event) Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`RibbonButtonBar`. :param `event`: a :class:`EraseEvent` event to be processed. .. method:: OnMouseDown(self, event) Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`RibbonButtonBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseEnter(self, event) Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`RibbonButtonBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseLeave(self, event) Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`RibbonButtonBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseMove(self, event) Handles the ``wx.EVT_MOTION`` event for :class:`RibbonButtonBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseUp(self, event) Handles the ``wx.EVT_LEFT_UP`` event for :class:`RibbonButtonBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnPaint(self, event) Handles the ``wx.EVT_PAINT`` event for :class:`RibbonButtonBar`. :param `event`: a :class:`PaintEvent` event to be processed. .. method:: OnSize(self, event) Handles the ``wx.EVT_SIZE`` event for :class:`RibbonButtonBar`. :param `event`: a :class:`wx.SizeEvent` event to be processed. .. 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:`RibbonBar.Realize() ` is called. .. note:: Reimplemented from :class:`~wx.lib.agw.ribbon.control.RibbonControl`. .. method:: SetArtProvider(self, art) Set the art provider to be used. In many cases, setting the art provider will also set the art provider on all child windows which extend :class:`~wx.lib.agw.ribbon.control.RibbonControl`. In most cases, controls will not take ownership of the given pointer, with the notable exception being :meth:`RibbonBar.SetArtProvider() `. :param `art`: an art provider. .. method:: ToggleButton(self, button_id, checked=True) Toggles/untoggles a :class:`RibbonButtonBar` toggle button. :param integer `button_id`: id of the button to be toggles/untoggled; :param bool `checked`: ``True`` to toggle the button, ``False`` to untoggle it. :raise: `Exception` when the input `button_id` could not be associated with a :class:`RibbonButtonBar` button. .. method:: TryCollapseLayout(self, original, first_btn, last_button=None) .. 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:`~RibbonButtonBar.UpdateWindowUI` from an idle function:: def OnInternalIdle(self): if wx.UpdateUIEvent.CanUpdate(self): self.UpdateWindowUI(wx.UPDATE_UI_FROMIDLE) .. versionadded:: 0.9.5