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
ToasterBoxmain style. Can be one of the following bits:ToasterBoxStyleValue
Description
TB_SIMPLE0x1
A simple
ToasterBox, with background image and text customization can be createdTB_COMPLEX0x2
ToasterBoxes with different degree of complexity can be created. You can add as many controls as you want, provided that you call the
AddPanelmethod 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_STYLE0x2008002
Default window style for
ToasterBox, with no caption nor close box.TB_CAPTION0x22009806
ToasterBoxwill have a caption, with the possibility to set a title for theToasterBoxframe, and a close box.closingstyle –
the closing style for
ToasterBox. Can be one of the following bits:Closing Styles
Hex Value
Description
TB_ONTIME0x1
ToasterBoxwill close after a specified amount of time.TB_ONCLICK0x2
ToasterBoxcan be closed by clicking anywhere on theToasterBoxframe.scrollType –
the scrolling direction for
ToasterBox. Can be one of the following bits:Scroll Styles
Hex Value
Description
TB_SCR_TYPE_UD0x1
ToasterBoxwill scroll from up to downTB_SCR_TYPE_DU0x2
ToasterBoxwill scroll from down to upTB_SCR_TYPE_FADE0x4
ToasterBoxwill 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
ToasterBoxcreated with theTB_COMPLEXstyle.
- CenterOnParent(self, direction=wx.BOTH)¶
Centres the window on its parent (if any). If the
ToasterBoxparent isNone, it callsCenterOnScreen.- Parameters:
direction – specifies the direction for the centering. May be
wx.HORIZONTAL,wx.VERTICALorwx.BOTH.
Note
This methods provides for a way to center
ToasterBoxover 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
ToasterBoxon screen.- Parameters:
direction – specifies the direction for the centering. May be
wx.HORIZONTAL,wx.VERTICALorwx.BOTH.
See also
- CleanList(self)¶
Cleans the window list, erasing the stack of
ToasterBoxobjects.
- GetToasterBoxWindow(self)¶
Returns the
ToasterBoxframe.
- GetUseFocus(self)¶
Returns whether
ToasterBoxwill steal the focus from the parent application.
- MoveAbove(self, tb)¶
If a
ToasterBoxalready 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_TIMERevent forToasterBox, moving the new window on top of the last one created.- Parameters:
event – a
TimerEventevent to be processed.
- Play(self)¶
Creates the
ToasterBoxWindow, that does all the job.
- SetPopupBackgroundColour(self, colour=None)¶
Sets the
ToasterBoxbackground colour.- Parameters:
colour – a valid
wx.Colourobject. If defaulted toNone, then the background colour will be white.
Note
Use this method only for a
ToasterBoxcreated with theTB_SIMPLEstyle.
- SetPopupBitmap(self, bitmap=None)¶
Sets the
ToasterBoxbackground image.- Parameters:
bitmap – a valid
wx.Bitmapobject or filename. If defaulted toNone, then no background bitmap is used.
Note
Use this method only for a
ToasterBoxcreated with theTB_SIMPLEstyle.
- SetPopupPauseTime(self, pausetime)¶
Sets the time after which the
ToasterBoxis destroyed (linger).- Parameters:
pausetime – the delay after which the control is destroyed, in seconds.
- SetPopupPosition(self, pos)¶
Sets the
ToasterBoxposition on screen.- Parameters:
pos – the widget position, an instance of
wx.Point.
- SetPopupPositionByInt(self, pos)¶
Sets the
ToasterBoxposition 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
ToasterBoxscroll speed.- Parameters:
speed – it is the pause time (in milliseconds) for every step in the ScrollUp method.
- SetPopupSize(self, size)¶
Sets the
ToasterBoxsize.- Parameters:
size – the new control size, an instance of
wx.Size.
- SetPopupText(self, text)¶
Sets the
ToasterBoxtext label.- Parameters:
text – the widget label.
Note
Use this method only for a
ToasterBoxcreated with theTB_SIMPLEstyle.
- SetPopupTextColour(self, colour=None)¶
Sets the
ToasterBoxforeground colour.- Parameters:
colour – a valid
wx.Colourobject. If defaulted toNone, then the background colour will be black.
Note
Use this method only for a
ToasterBoxcreated with theTB_SIMPLEstyle.
- SetPopupTextFont(self, font=None)¶
Sets the
ToasterBoxtext font.- Parameters:
colour – a valid
wx.Colourobject. If defaulted toNone, then a simple generic font will be generated.
Note
Use this method only for a
ToasterBoxcreated with theTB_SIMPLEstyle.
- SetTitle(self, title)¶
Sets the
ToasterBoxtitle if it was created withTB_CAPTIONwindow style.- Parameters:
title – the
ToasterBoxcaption title.
- SetUseFocus(self, focus)¶
If focus is
True, InstructsToasterBoxto steal the focus from the parent application, otherwise it returns the focus to the original owner.- Parameters:
focus –
Trueto set the focus onToasterBox,Falseto return it to the original owner.