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¶
Control Appearance¶
Known Superclasses¶
Methods Summary¶
Default class constructor. |
|
Adds a button to be shown in the info bar. |
|
Hides the |
|
Hides this |
|
Shows this |
|
Determines the placement of the bar from its position in the containing |
|
Returns the default border style for |
|
Return the effect animation duration currently used, in milliseconds. |
|
Return the effect currently used for hiding the bar. |
|
Return the effect currently used for showing the bar. |
|
Common initialization code. |
|
Default event handler for the Close button in |
|
Remove a button previously added by |
|
Sets the duration of the animation used when showing or hiding the bar. |
|
Overridden base class methods changes the font of the text message. |
|
Set the effects to use when showing and hiding the bar. |
|
Show a message in the bar. |
|
Updates the parent layout appearance, but only if this |
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++.
Methods¶
- __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name='InfoBar')¶
Default class constructor.
- Parameters:
parent – parent window. Must not be
None
;id (integer) – window identifier. A value of -1 indicates a default value;
pos (tuple or
wx.Point
) – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;size (tuple or
wx.Size
) – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;style (integer) – the
InfoBar
style (unused at present);name (string) – the control name.
- 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 inInfoBar
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 (callingDismiss
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.- Parameters:
btnid (integer) – id of the button. It will be used in the button message clicking this button will generate;
label (string) – 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;
bitmap – if not equal to
NullBitmap
, a validwx.Bitmap
image to show beside the button text.
- Dismiss(self)¶
Hides the
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
InfoBar
parent is not managed byframemanager
orAuiManager
.
- GetBarPlacement(self)¶
Determines the placement of the bar from its position in the containing sizer.
- GetEffectDuration(self)¶
Return the effect animation duration currently used, in milliseconds.
- GetHideEffect(self)¶
Return the effect currently used for hiding the bar.
- Returns:
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
InfoBar
window to the top.wx.SHOW_EFFECT_SLIDE_TO_BOTTOM
0x8
Slide the
InfoBar
window to the bottom.
- GetShowEffect(self)¶
Return the effect currently used for showing the bar.
- Returns:
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
InfoBar
window to the top.wx.SHOW_EFFECT_SLIDE_TO_BOTTOM
0x8
Slide the
InfoBar
window to the bottom.
- Init(self)¶
Common initialization code.
- OnButton(self, event)¶
Default event handler for the
Close
button inInfoBar
.- Parameters:
event – a
CommandEvent
to be processed.
- RemoveButton(self, btnid)¶
Remove a button previously added by
AddButton
.- Parameters:
btnid (integer) – id of the button to remove. If more than one button with the same id is used in the
InfoBar
(which is in any case not recommended), the last, i.e. most recently added, button with thisid
is removed.
- SetEffectDuration(self, duration)¶
Sets the duration of the animation used when showing or hiding the bar.
By default, 500ms duration is used.
- Parameters:
duration (integer) – duration of the animation, in milliseconds.
- SetFont(self, font)¶
Overridden base class methods changes the font of the text message.
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.- Parameters:
font – a valid instance of
wx.Font
.
Note
Reimplemented from
wx.Window
.
- 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 andwx.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.- Parameters:
showEffect (integer) – the effect to use when showing the bar;
hideEffect (integer) – 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.
- 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.
- Parameters:
msg (string) – the text of the message;
flags (integer) –
one of
wx.ICON_NONE
,wx.ICON_INFORMATION
(default),wx.ICON_QUESTION
,wx.ICON_WARNING
orwx.ICON_ERROR
values.Note
These flags have the same meaning as in
MessageDialog
for the generic version, i.e. show (or not, in case ofwx.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.
- UpdateParent(self)¶
Updates the parent layout appearance, but only if this
InfoBar
parent is not managed byframemanager
orAuiManager
.