.. wxPython Phoenix documentation

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

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

.. include:: headings.inc

.. currentmodule:: wx.lib.agw.infobar

.. highlight:: python



.. _wx.lib.agw.infobar.InfoBar:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.infobar.InfoBar**
==========================================================================================================================================

An info bar is a transient window shown at top or bottom of its parent window to display
non-critical information to the user.

This is the main class implementation, plainly translated from C++.



|

|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>InfoBar</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.lib.agw.infobar.InfoBar_inheritance.png" alt="Inheritance diagram of InfoBar" 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.Trackable.html" title="wx.Trackable" alt="" coords="5,5,107,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="57,83,168,112"/> <area shape="rect" id="node2" href="wx.Control.html" title="wx.Control" alt="" coords="69,315,157,344"/> <area shape="rect" id="node6" href="wx.lib.agw.infobar.InfoBar.html" title="wx.lib.agw.infobar.InfoBar" alt="" coords="23,392,203,421"/> <area shape="rect" id="node3" href="wx.Window.html" title="wx.Window" alt="" coords="69,237,157,267"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="53,160,173,189"/> <area shape="rect" id="node7" href="wx.Object.html" title="wx.Object" alt="" coords="131,5,212,35"/> </map> 
   </p>

|


|appearance| Control Appearance
===============================

|

.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.infobar.infobar.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/../no_appearance.png
   :alt: wxGTK
   :figclass: floatcenter

   **wxGTK**


|




|super_classes| Known Superclasses
==================================

:class:`wx.Control`

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.agw.infobar.InfoBar.__init__`                                     Default class constructor.
:meth:`~wx.lib.agw.infobar.InfoBar.AddButton`                                    Adds a button to be shown in the info bar.
:meth:`~wx.lib.agw.infobar.InfoBar.Dismiss`                                      Hides the :class:`InfoBar` window.
:meth:`~wx.lib.agw.infobar.InfoBar.DoHide`                                       Hides this :class:`InfoBar` with whatever hiding effect has been chosen.
:meth:`~wx.lib.agw.infobar.InfoBar.DoShow`                                       Shows this :class:`InfoBar` with whatever showing effect has been chosen.
:meth:`~wx.lib.agw.infobar.InfoBar.GetBarPlacement`                              Determines the placement of the bar from its position in the containing
:meth:`~wx.lib.agw.infobar.InfoBar.GetDefaultBorder`                             Returns the default border style for :class:`InfoBar`.
:meth:`~wx.lib.agw.infobar.InfoBar.GetEffectDuration`                            Return the effect animation duration currently used, in milliseconds.
:meth:`~wx.lib.agw.infobar.InfoBar.GetHideEffect`                                Return the effect currently used for hiding the bar.
:meth:`~wx.lib.agw.infobar.InfoBar.GetShowEffect`                                Return the effect currently used for showing the bar.
:meth:`~wx.lib.agw.infobar.InfoBar.Init`                                         Common initialization code.
:meth:`~wx.lib.agw.infobar.InfoBar.OnButton`                                     Default event handler for the `Close` button in :class:`InfoBar`.
:meth:`~wx.lib.agw.infobar.InfoBar.RemoveButton`                                 Remove a button previously added by :meth:`~InfoBar.AddButton`.
:meth:`~wx.lib.agw.infobar.InfoBar.SetEffectDuration`                            Sets the duration of the animation used when showing or hiding the bar.
:meth:`~wx.lib.agw.infobar.InfoBar.SetFont`                                      Overridden base class methods changes the font of the text message.
:meth:`~wx.lib.agw.infobar.InfoBar.SetShowHideEffects`                           Set the effects to use when showing and hiding the bar.
:meth:`~wx.lib.agw.infobar.InfoBar.ShowMessage`                                  Show a message in the bar.
:meth:`~wx.lib.agw.infobar.InfoBar.UpdateParent`                                 Updates the parent layout appearance, but only if this :class:`InfoBar` parent is **not** managed
================================================================================ ================================================================================


|


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


.. class:: InfoBar(wx.Control)

   An info bar is a transient window shown at top or bottom of its parent window to display
   non-critical information to the user.
   
   This is the main class implementation, plainly translated from C++.

   .. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name='InfoBar')

      Default class constructor.
      
      :param `parent`: parent window. Must not be ``None``;
      :param integer `id`: window identifier. A value of -1 indicates a default value;
      :param `pos`: the control position. A value of (-1, -1) indicates a default position,
       chosen by either the windowing system or wxPython, depending on platform;
      :type `pos`: tuple or :class:`wx.Point`
      :param `size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :type `size`: tuple or :class:`wx.Size`
      :param integer `style`: the :class:`InfoBar` style (unused at present);
      :param string `name`: the control name.


   .. method:: AddButton(self, btnid, label='', bitmap=wx.NullBitmap)

      Adds a button to be shown in the info bar.
      
      The button added by this method will be shown to the right of the text (in LTR layout),
      with each successive button being added to the right of the previous one. If any buttons
      are added to the info bar using this method, the default `Close` button is not shown
      as it is assumed that the extra buttons already allow the user to close it.
      
      Clicking the button will generate a normal ``wx.wxEVT_COMMAND_BUTTON_CLICKED`` event which
      can be handled as usual. The default handler in :class:`InfoBar` itself closes the window
      whenever a button in it is clicked so if you wish the info bar to be hidden when the button
      is clicked, simply call `event.Skip()` in the button handler to let the base class handler
      do it (calling :meth:`~InfoBar.Dismiss` explicitly works too, of course). On the other hand, if you don't
      skip the event, the info bar will remain opened so make sure to do it for at least some
      buttons to allow the user to close it.
      
      :param integer `btnid`: id of the button. It will be used in the button message clicking
       this button will generate;
      :param string `label`: the label of the button. It may only be empty if `btnid` is one of
       the stock ids in which case the corresponding stock label will be used;
      :param `bitmap`: if not equal to :class:`NullBitmap`, a valid :class:`wx.Bitmap` image to show beside
       the button text.
      
      :note:
      
           Notice that the generic :class:`InfoBar` implementation handles the button events itself
           and so they are not propagated to the info bar parent and you need to either inherit from
           :class:`InfoBar` and handle them in your derived class or use `self.Bind(...)` to handle the
           button events in the parent frame.


   .. method:: Dismiss(self)

      Hides the :class:`InfoBar` window.
      
      This method hides the window and lays out the parent window to account for
      its disappearance (unlike a simple `Hide()`), but only if this :class:`InfoBar`
      parent is **not** managed by :class:`framemanager` or :class:`~wx.lib.agw.aui.framemanager.AuiManager`.


   .. method:: DoHide(self)

      Hides this :class:`InfoBar` with whatever hiding effect has been chosen. 


   .. method:: DoShow(self)

      Shows this :class:`InfoBar` with whatever showing effect has been chosen. 


   .. method:: GetBarPlacement(self)

      Determines the placement of the bar from its position in the containing
      sizer.
      
      :return: One of these integer bits:
      
       ========================== =========== ==================================================
       Placement Flag             Hex Value   Description
       ========================== =========== ==================================================
       ``BarPlacement_Unknown``           0x0 Unknown placement of :class:`InfoBar` (not good).
       ``BarPlacement_Top``               0x1 :class:`InfoBar` is placed at the top of its parent.
       ``BarPlacement_Bottom``            0x2 :class:`InfoBar` is placed at the bottom of its parent.
       ========================== =========== ==================================================


   .. method:: GetDefaultBorder(self)

      Returns the default border style for :class:`InfoBar`. 


   .. method:: GetEffectDuration(self)

      Return the effect animation duration currently used, in milliseconds. 


   .. method:: GetHideEffect(self)

      Return the effect currently used for hiding the bar.
      
      :return: One of the following integer bits:
      
       ================================== =========== ==================================================
       `ShowEffect` Flag                  Hex Value   Description
       ================================== =========== ==================================================
       ``wx.SHOW_EFFECT_NONE``                    0x0 No effect, equivalent to normal `Show()` or `Hide()` call.
       ``wx.SHOW_EFFECT_SLIDE_TO_TOP``            0x7 Slide the :class:`InfoBar` window to the top.
       ``wx.SHOW_EFFECT_SLIDE_TO_BOTTOM``         0x8 Slide the :class:`InfoBar` window to the bottom.
       ================================== =========== ==================================================


   .. method:: GetShowEffect(self)

      Return the effect currently used for showing the bar.
      
      :return: One of the following integer bits:
      
       ================================== =========== ==================================================
       `ShowEffect` Flag                  Hex Value   Description
       ================================== =========== ==================================================
       ``wx.SHOW_EFFECT_NONE``                    0x0 No effect, equivalent to normal `Show()` or `Hide()` call.
       ``wx.SHOW_EFFECT_SLIDE_TO_TOP``            0x7 Slide the :class:`InfoBar` window to the top.
       ``wx.SHOW_EFFECT_SLIDE_TO_BOTTOM``         0x8 Slide the :class:`InfoBar` window to the bottom.
       ================================== =========== ==================================================


   .. method:: Init(self)

      Common initialization code. 


   .. method:: OnButton(self, event)

      Default event handler for the `Close` button in :class:`InfoBar`.
      
      :param `event`: a :class:`CommandEvent` to be processed.
      
      :note:
      
           Notice that the generic :class:`InfoBar` implementation handles the button events itself
           and so they are not propagated to the info bar parent and you need to either inherit from
           :class:`InfoBar` and handle them in your derived class or use `self.Bind(...)` to handle the
           button events in the parent frame.


   .. method:: RemoveButton(self, btnid)

      Remove a button previously added by :meth:`~InfoBar.AddButton`.
      
      :param integer `btnid`: id of the button to remove. If more than one button with the
       same id is used in the :class:`InfoBar` (which is in any case not recommended), the last,
       i.e. most recently added, button with this `id` is removed.


   .. method:: SetEffectDuration(self, duration)

      Sets the duration of the animation used when showing or hiding the bar.
      
      By default, 500ms duration is used.
      
      :param integer `duration`: duration of the animation, in milliseconds.


   .. method:: SetFont(self, font)

      Overridden base class methods changes the font of the text message.
      
      :class:`InfoBar` overrides this method to use the font passed to it for its text
      message part. By default a larger and bold version of the standard font is used.
      
      :param `font`: a valid instance of :class:`wx.Font`.
      
      :note: Reimplemented from :class:`wx.Window`.


   .. method:: SetShowHideEffects(self, showEffect, hideEffect)

      Set the effects to use when showing and hiding the bar.
      
      Either or both of the parameters can be set to ``wx.SHOW_EFFECT_NONE`` to disable using
      effects entirely.
      
      By default, the info bar uses ``wx.SHOW_EFFECT_SLIDE_TO_BOTTOM`` effect for showing itself
      and ``wx.SHOW_EFFECT_SLIDE_TO_TOP`` for hiding if it is the first element of the containing
      sizer and reverse effects if it's the last one. If it is neither the first nor the last element,
      no effect is used to avoid the use of an inappropriate one and this function must be called
      if an effect is desired.
      
      :param integer `showEffect`: the effect to use when showing the bar;
      :param integer `hideEffect`: the effect to use when hiding the bar.
      
      The `showEffect` and `hideEffect` parameters can take one of the following bit:
      
      ==================================== ===========================================================
      `ShowEffect` Flag                    Description
      ==================================== ===========================================================
      ``SHOW_EFFECT_NONE``                 No effect, equivalent to normal `Show()` or `Hide()` call.
      ``SHOW_EFFECT_ROLL_TO_LEFT``         Roll window to the left.
      ``SHOW_EFFECT_ROLL_TO_RIGHT``        Roll window to the right.
      ``SHOW_EFFECT_ROLL_TO_TOP``          Roll window to the top.
      ``SHOW_EFFECT_ROLL_TO_BOTTOM``       Roll window to the bottom.
      ``SHOW_EFFECT_SLIDE_TO_LEFT``        Slide window to the left.
      ``SHOW_EFFECT_SLIDE_TO_RIGHT``       Slide window to the right.
      ``SHOW_EFFECT_SLIDE_TO_TOP``         Slide window to the top.
      ``SHOW_EFFECT_SLIDE_TO_BOTTOM``      Slide window to the bottom.
      ``SHOW_EFFECT_BLEND``                Fade in or out effect.
      ``SHOW_EFFECT_EXPAND``               Expanding or collapsing effect.
      ==================================== ===========================================================


   .. method:: ShowMessage(self, msg, flags=wx.ICON_INFORMATION)

      Show a message in the bar.
      
      If the bar is currently hidden, it will be shown. Otherwise its message will be updated in place.
      
      :param string `msg`: the text of the message;
      :param integer `flags`: one of ``wx.ICON_NONE``, ``wx.ICON_INFORMATION`` (default), ``wx.ICON_QUESTION``,
       ``wx.ICON_WARNING`` or ``wx.ICON_ERROR`` values.
      
       :note: These flags have the same meaning as in :class:`MessageDialog` for the generic version, i.e.
        show (or not, in case of ``wx.ICON_NONE``) the corresponding icon in the bar but can be interpreted
        by the native versions. For example, the GTK+ native implementation doesn't show icons at all but
        uses this parameter to select the appropriate background colour for the notification.


   .. method:: UpdateParent(self)

      Updates the parent layout appearance, but only if this :class:`InfoBar` parent is **not** managed
      by :class:`framemanager` or :class:`~wx.lib.agw.aui.framemanager.AuiManager`.


