AGW Logo

agw_title toasterbox

ToasterBox is a cross-platform widget to make the creation of MSN style “toaster” popups easier.


description Description

ToasterBox is a cross-platform widget to make the creation of MSN style “toaster” popups easier. The syntax is really easy especially if you are familiar with the syntax of wxPython.

It has 2 main styles:

  • TB_SIMPLE: using this style, you will be able to specify a background image for ToasterBox, text properties as text colour, font and label;
  • TB_COMPLEX: this style will allow you to put almost any control inside a ToasterBox. You can add a panel in which you can put all the controls you like.

Both styles support the setting of ToasterBox position (on screen coordinates), size, the time after which the ToasterBox is destroyed (linger), and the scroll speed of ToasterBox.


usage Usage

Usage example:

import wx
import wx.lib.agw.toasterbox as TB

class MyFrame(wx.Frame):

    def __init__(self, parent):

        wx.Frame.__init__(self, parent, -1, "ToasterBox Demo")

        toaster = TB.ToasterBox(self, tbstyle=TB.TB_COMPLEX)
        toaster.SetPopupPauseTime(3000)

        tbpanel = toaster.GetToasterBoxWindow()
        panel = wx.Panel(tbpanel, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)

        button = wx.Button(panel, wx.ID_ANY, "Simple button")
        sizer.Add(button, 0, wx.EXPAND)

        panel.SetSizer(sizer)
        toaster.AddPanel(panel)

        wx.CallLater(1000, toaster.Play)


# 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

ToasterBox has been tested on the following platforms:

  • Windows (verified on Windows XP, 2000)
  • Linux
  • Mac

styles Window Styles

This class supports the following window styles:


Window styles for toasterbox
Window Styles Hex Value Description
TB_SIMPLE 0x1 A simple ToasterBox, with background image and text customization can be created.
TB_ONTIME 0x1 ToasterBox will close after a specified amount of time.
TB_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 a wx.Panel. See the demo for details.
TB_ONCLICK 0x2 ToasterBox can be closed by clicking anywhere on the ToasterBox frame.
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 the ToasterBox frame, and a close box.

events Events Processing

No custom events are available for this class.


license License And Version

ToasterBox is distributed under the wxPython license.

Latest revision: Andrea Gavana @ 17 Aug 2011, 15.00 GMT

Version 0.3

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


hierarchy Inheritance Diagram

Inheritance diagram for module: toasterbox

Inheritance diagram of toasterbox.ToasterBox, toasterbox.ToasterBoxWindow


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.

toasterbox

Revision Graph For toasterbox


2to3 Python 3 Issues (via 2to3)

No issues have been detected by 2to3.py.