AGW Logo

agw_title 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 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 InfoBar is a direct translation of the generic C++ implementation of wx.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.

InfoBar calls its parent Layout() method (if its parent is not managed by AuiManager or wx.aui.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 wx.BoxSizer and the bar its first or last element.


base Base Functionalities

InfoBar supports all the wx.InfoBar generic implementation functionalities, and in addition it using AddButton it is possible to add a button with a bitmap (and not only a plain wx.Button).

For example:

info = InfoBar(parent)
bitmap = wx.Bitmap('nice_bitmap.png', wx.BITMAP_TYPE_PNG)

info.AddButton(wx.NewId(), 'New Button', bitmap)

usage 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.AddF(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.PySimpleApp()

frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()

app.MainLoop()

This code snippet can be downloaded, see this example script.

Note

Some of the AGW snippets of code in the documentation use images and external files (to create bitmaps or access external data). As these files are not provided in these snippets, you should make the approriate modifications to the code to actually run it.


platforms Supported Platforms

InfoBar has been tested on the following platforms:
  • Windows (Vista/7).

styles Window Styles

No particular window styles are available for this class.


events Events Processing

This class processes the following events:


Events processing for infobar
Event Name Description
wx.EVT_BUTTON Process a wx.wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.

license License And Version

InfoBar control is distributed under the wxPython license.

Latest Revision: Andrea Gavana @ 12 Mar 2012, 21.00 GMT

Version 0.1

Module author: Andrea Gavana <andrea.gavana@gmail.com>


hierarchy Inheritance Diagram

Inheritance diagram for module: infobar

Inheritance diagram of infobar.InfoBar


svn_main SVN Revisions

A graphical representation of the SVN commits in the last year.

Click on any date in the picture to jump to that particular revision page, containing information about committers, log messages and SVN diffs.

infobar

Revision Graph For infobar


2to3 Python 3 Issues (via 2to3)

No issues have been detected by 2to3.py.


method_summary Function Summary