Using InfoBar
The InfoBar
control is a new control that was added in wxPython 3.0. This control acts similarly to the small informational bar that pops into view at the top of some web browsers. It can be used to present simple messages or get responses to questions, just as a MessageBox
function can, but it is presented in a less obtrusive way, which does not require acknowledgement from the user or prevents them from continuing to use the program. In this recipe, we will look at how to integrate an InfoBar
control into your application's frames.
How to do it…
You would need to perform the following steps:
First, let's start by making a subclass of
InfoBar
that we will add an Auto Dismiss feature to through the following code:class AutoDismissInfo(wx.InfoBar): def __init__(self, parent, hideAfter=-1): super(AutoDismissInfo, self).__init__(parent) self._timer = wx.Timer(self) self._limit = hideAfter self.Bind(wx.EVT_TIMER, lambda event: self.Dismiss...