wx.lib.agw.toasterbox.ToasterBox¶
ToasterBox is a cross-platform widget to make the creation of MSN style “toaster” popups easier.
Class Hierarchy¶
Control Appearance¶
Known Superclasses¶
Methods Summary¶
Default class constructor. |
|
Adds a panel to the |
|
Centres the window on its parent (if any). If the |
|
Centres the |
|
Cleans the window list, erasing the stack of |
|
Returns the |
|
Returns whether |
|
If a |
|
It’s time to hide a |
|
Handles the |
|
Creates the |
|
Sets the |
|
Sets the |
|
Sets the time after which the |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the |
|
If focus is |
Class API¶
- class ToasterBox(wx.Timer)¶
ToasterBox is a cross-platform widget to make the creation of MSN style “toaster” popups easier.
Methods¶
- __init__(self, parent, tbstyle=TB_SIMPLE, windowstyle=TB_DEFAULT_STYLE, closingstyle=TB_ONTIME, scrollType=TB_SCR_TYPE_DU)¶
Default class constructor.
- Parameters:
parent – the window parent;
tbstyle –
the
ToasterBox
main style. Can be one of the following bits:ToasterBox
StyleValue
Description
TB_SIMPLE
0x1
A simple
ToasterBox
, with background image and text customization can be createdTB_COMPLEX
0x2
ToasterBoxes with different degree of complexity can be created. You can add as many controls as you want, provided that you call the
AddPanel
method and pass to it a dummy frame and aPanel
.windowstyle –
this parameter influences the visual appearance of
ToasterBox
, and can be one of the following styles:Window Style
Hex Value
Description
TB_DEFAULT_STYLE
0x2008002
Default window style for
ToasterBox
, with no caption nor close box.TB_CAPTION
0x22009806
ToasterBox
will have a caption, with the possibility to set a title for theToasterBox
frame, and a close box.closingstyle –
the closing style for
ToasterBox
. Can be one of the following bits:Closing Styles
Hex Value
Description
TB_ONTIME
0x1
ToasterBox
will close after a specified amount of time.TB_ONCLICK
0x2
ToasterBox
can be closed by clicking anywhere on theToasterBox
frame.scrollType –
the scrolling direction for
ToasterBox
. Can be one of the following bits:Scroll Styles
Hex Value
Description
TB_SCR_TYPE_UD
0x1
ToasterBox
will scroll from up to downTB_SCR_TYPE_DU
0x2
ToasterBox
will scroll from down to upTB_SCR_TYPE_FADE
0x4
ToasterBox
will fade in/out (without scrolling).
- AddPanel(self, panel)¶
Adds a panel to the
ToasterBox
.- Parameters:
panel – an instance of
wx.Window
.
Note
Use this method only for a
ToasterBox
created with theTB_COMPLEX
style.
- CenterOnParent(self, direction=wx.BOTH)¶
Centres the window on its parent (if any). If the
ToasterBox
parent isNone
, it callsCenterOnScreen
.- Parameters:
direction – specifies the direction for the centering. May be
wx.HORIZONTAL
,wx.VERTICAL
orwx.BOTH
.
Note
This methods provides for a way to center
ToasterBox
over their parents instead of the entire screen. If there is no parent, then behaviour is the same asCenterOnScreen
.See also
- CenterOnScreen(self, direction=wx.BOTH)¶
Centres the
ToasterBox
on screen.- Parameters:
direction – specifies the direction for the centering. May be
wx.HORIZONTAL
,wx.VERTICAL
orwx.BOTH
.
See also
- CleanList(self)¶
Cleans the window list, erasing the stack of
ToasterBox
objects.
- GetToasterBoxWindow(self)¶
Returns the
ToasterBox
frame.
- GetUseFocus(self)¶
Returns whether
ToasterBox
will steal the focus from the parent application.
- MoveAbove(self, tb)¶
If a
ToasterBox
already exists, move the new one above the existing one.- Parameters:
tb – another instance of
ToasterBox
.
- Notify(self)¶
It’s time to hide a
ToasterBox
.
- OnMoveTimer(self, event)¶
Handles the
wx.EVT_TIMER
event forToasterBox
, moving the new window on top of the last one created.- Parameters:
event – a
TimerEvent
event to be processed.
- Play(self)¶
Creates the
ToasterBoxWindow
, that does all the job.
- SetPopupBackgroundColour(self, colour=None)¶
Sets the
ToasterBox
background colour.- Parameters:
colour – a valid
wx.Colour
object. If defaulted toNone
, then the background colour will be white.
Note
Use this method only for a
ToasterBox
created with theTB_SIMPLE
style.
- SetPopupBitmap(self, bitmap=None)¶
Sets the
ToasterBox
background image.- Parameters:
bitmap – a valid
wx.Bitmap
object or filename. If defaulted toNone
, then no background bitmap is used.
Note
Use this method only for a
ToasterBox
created with theTB_SIMPLE
style.
- SetPopupPauseTime(self, pausetime)¶
Sets the time after which the
ToasterBox
is destroyed (linger).- Parameters:
pausetime – the delay after which the control is destroyed, in seconds.
- SetPopupPosition(self, pos)¶
Sets the
ToasterBox
position on screen.- Parameters:
pos – the widget position, an instance of
wx.Point
.
- SetPopupPositionByInt(self, pos)¶
Sets the
ToasterBox
position on screen, at one of the screen corners.- Parameters:
pos – an integer specifying the screen corner, namely:
Corner Number
Position
0
Top left screen corner
1
Top right screen corner
2
Bottom left screen corner
3
Bottom right screen corner
- SetPopupScrollSpeed(self, speed)¶
Sets the
ToasterBox
scroll speed.- Parameters:
speed – it is the pause time (in milliseconds) for every step in the ScrollUp method.
- SetPopupSize(self, size)¶
Sets the
ToasterBox
size.- Parameters:
size – the new control size, an instance of
wx.Size
.
- SetPopupText(self, text)¶
Sets the
ToasterBox
text label.- Parameters:
text – the widget label.
Note
Use this method only for a
ToasterBox
created with theTB_SIMPLE
style.
- SetPopupTextColour(self, colour=None)¶
Sets the
ToasterBox
foreground colour.- Parameters:
colour – a valid
wx.Colour
object. If defaulted toNone
, then the background colour will be black.
Note
Use this method only for a
ToasterBox
created with theTB_SIMPLE
style.
- SetPopupTextFont(self, font=None)¶
Sets the
ToasterBox
text font.- Parameters:
colour – a valid
wx.Colour
object. If defaulted toNone
, then a simple generic font will be generated.
Note
Use this method only for a
ToasterBox
created with theTB_SIMPLE
style.
- SetTitle(self, title)¶
Sets the
ToasterBox
title if it was created withTB_CAPTION
window style.- Parameters:
title – the
ToasterBox
caption title.
- SetUseFocus(self, focus)¶
If focus is
True
, InstructsToasterBox
to steal the focus from the parent application, otherwise it returns the focus to the original owner.- Parameters:
focus –
True
to set the focus onToasterBox
,False
to return it to the original owner.