.. 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 .. module:: wx.lib.agw.infobar .. currentmodule:: wx.lib.agw.infobar .. highlight:: python .. _wx.lib.agw.infobar: ========================================================================================================================================== |phoenix_title| **wx.lib.agw.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. Description =========== An info bar is a transient window shown at top or bottom of its parent window to display non-critical information to the user. .. note:: The Python implementation of :class:`InfoBar` is a direct translation of the generic C++ implementation of :class:`InfoBar`. This class provides another way to show messages to the user, intermediate between message boxes and status bar messages. The message boxes are modal and thus interrupt the users work flow and should be used sparingly for this reason. However status bar messages are often too easy not to notice at all. An info bar provides a way to present the messages which has a much higher chance to be noticed by the user but without being annoying. Info bar may show an icon (on the left), text message and, optionally, buttons allowing the user to react to the information presented. It always has a close button at the right allowing the user to dismiss it so it isn't necessary to provide a button just to close it. :class:`InfoBar` calls its parent `Layout()` method (if its parent is **not** managed by :class:`~aui.framemanager` or :class:`~wx.lib.agw.aui.framemanager.AuiManager`) and assumes that it will change the parent layout appropriately depending on whether the info bar itself is shown or hidden. Usually this is achieved by simply using a sizer for the parent window layout and adding wxInfoBar to this sizer as one of the items. Considering the usual placement of the info bars, normally this sizer should be a vertical :class:`BoxSizer` and the bar its first or last element. Base Functionalities ==================== :class:`InfoBar` supports all the :class:`InfoBar` generic implementation functionalities, and in addition it using :meth:`~InfoBar.AddButton` it is possible to add a button with a bitmap (and not only a plain :class:`Button`). For example:: info = InfoBar(parent) bitmap = wx.Bitmap('nice_bitmap.png', wx.BITMAP_TYPE_PNG) info.AddButton(wx.ID_ANY, 'New Button', bitmap) Usage ===== The simplest possible example of using this class would be:: import wx import wx.lib.agw.infobar as IB class MyFrame(wx.Frame): def __init__(self, parent): wx.Frame.__init__(self, parent, -1, 'InfoBar Demo') self._infoBar = IB.InfoBar(self) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self._infoBar, wx.SizerFlags().Expand()) panel = wx.Panel(self) sizer.Add(panel, 1, wx.EXPAND) # ... Add other frame controls to the sizer ... self.SetSizer(sizer) wx.CallLater(2000, self.SomeMethod) def SomeMethod(self): self._infoBar.ShowMessage("Something happened", wx.ICON_INFORMATION) # our normal wxApp-derived class, as usual app = wx.App(0) frame = MyFrame(None) app.SetTopWindow(frame) frame.Show() app.MainLoop() Supported Platforms =================== :class:`InfoBar` has been tested on the following platforms: * Windows (Vista/7). Window Styles ============= `No particular window styles are available for this class.` Events Processing ================= This class processes the following events: ================= ================================================== Event Name Description ================= ================================================== ``wx.EVT_BUTTON`` Process a `wx.wxEVT_COMMAND_BUTTON_CLICKED` event, when the button is clicked. ================= ================================================== License And Version =================== :class:`InfoBar` control is distributed under the wxPython license. Latest Revision: Andrea Gavana @ 27 Dec 2012, 21.00 GMT Version 0.3 |function_summary| Functions Summary ==================================== ================================================================================ ================================================================================ :func:`~wx.lib.agw.infobar.GetCloseButtonBitmap` For platforms supporting it (namely wxMSW and wxMAC), this method uses :class:`RendererNative` ================================================================================ ================================================================================ | |class_summary| Classes Summary =============================== ================================================================================ ================================================================================ `~wx.lib.agw.infobar.AutoWrapStaticText` A simple class derived from :mod:`lib.stattext` that implements auto-wrapping `~wx.lib.agw.infobar.InfoBar` An info bar is a transient window shown at top or bottom of its parent window to display ================================================================================ ================================================================================ | .. toctree:: :maxdepth: 1 :hidden: wx.lib.agw.infobar.AutoWrapStaticText wx.lib.agw.infobar.InfoBar Functions ------------ .. function:: GetCloseButtonBitmap(win, size, colBg, flags=0) For platforms supporting it (namely wxMSW and wxMAC), this method uses :class:`RendererNative` to draw a natively-looking close button on the :class:`InfoBar` itself. :param `win`: the window in which we wish to draw the close button (an instance of :class:`InfoBar`); :param tuple `size`: the close button size, a tuple of `(width, height)` dimensions in pixels; :param `colBg`: the background colour of the parent window, an instance of :class:`wx.Colour`; :param integer `flags`: may have the ``wx.CONTROL_PRESSED``, ``wx.CONTROL_CURRENT`` or ``wx.CONTROL_ISDEFAULT`` bit set.