.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.toasterbox
.. highlight:: python
.. _wx.lib.agw.toasterbox.ToasterBox:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.toasterbox.ToasterBox**
==========================================================================================================================================
ToasterBox is a cross-platform widget to make the creation of MSN style "toaster"
popups easier.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
ToasterBox:
|
|appearance| Control Appearance
===============================
|
.. container:: control-appearance-figures
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.toasterbox.toasterbox.png
:alt: wxMSW
:figclass: appearance-figure
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: appearance-figure
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/../no_appearance.png
:alt: wxGTK
:figclass: appearance-figure
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.Timer`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.toasterbox.ToasterBox.__init__` Default class constructor.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.AddPanel` Adds a panel to the :class:`ToasterBox`.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.CenterOnParent` Centres the window on its parent (if any). If the :class:`ToasterBox` parent is ``None``,
:meth:`~wx.lib.agw.toasterbox.ToasterBox.CenterOnScreen` Centres the :class:`ToasterBox` on screen.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.CleanList` Cleans the window list, erasing the stack of :class:`ToasterBox` objects.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.GetToasterBoxWindow` Returns the :class:`ToasterBox` frame.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.GetUseFocus` Returns whether :class:`ToasterBox` will steal the focus from the parent application.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.MoveAbove` If a :class:`ToasterBox` already exists, move the new one above the existing one.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.Notify` It's time to hide a :class:`ToasterBox`.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.OnMoveTimer` Handles the ``wx.EVT_TIMER`` event for :class:`ToasterBox`, moving the new window
:meth:`~wx.lib.agw.toasterbox.ToasterBox.Play` Creates the :class:`ToasterBoxWindow`, that does all the job.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupBackgroundColour` Sets the :class:`ToasterBox` background colour.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupBitmap` Sets the :class:`ToasterBox` background image.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupPauseTime` Sets the time after which the :class:`ToasterBox` is destroyed (linger).
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupPosition` Sets the :class:`ToasterBox` position on screen.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupPositionByInt` Sets the :class:`ToasterBox` position on screen, at one of the screen corners.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupScrollSpeed` Sets the :class:`ToasterBox` scroll speed.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupSize` Sets the :class:`ToasterBox` size.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupText` Sets the :class:`ToasterBox` text label.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupTextColour` Sets the :class:`ToasterBox` foreground colour.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetPopupTextFont` Sets the :class:`ToasterBox` text font.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetTitle` Sets the :class:`ToasterBox` title if it was created with ``TB_CAPTION`` window style.
:meth:`~wx.lib.agw.toasterbox.ToasterBox.SetUseFocus` If `focus` is ``True``, Instructs :class:`ToasterBox` to steal the focus from the
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: ToasterBox(wx.Timer)
ToasterBox is a cross-platform widget to make the creation of MSN style "toaster"
popups easier.
.. method:: __init__(self, parent, tbstyle=TB_SIMPLE, windowstyle=TB_DEFAULT_STYLE, closingstyle=TB_ONTIME, scrollType=TB_SCR_TYPE_DU)
Default class constructor.
:param `parent`: the window parent;
:param `tbstyle`: the :class:`ToasterBox` main style. Can be one of the following
bits:
====================== ======= ================================
`ToasterBox` Style Value Description
====================== ======= ================================
``TB_SIMPLE`` 0x1 A simple :class:`ToasterBox`, with background image and text customization can be created
``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 :meth:`~ToasterBox.AddPanel` method and pass to it a dummy frame and a :class:`Panel`.
====================== ======= ================================
:param `windowstyle`: this parameter influences the visual appearance of
:class:`ToasterBox`, and can be one of the following styles:
====================== ========== ================================
Window Style Hex Value Description
====================== ========== ================================
``TB_DEFAULT_STYLE`` 0x2008002 Default window style for :class:`ToasterBox`, with no caption nor close box.
``TB_CAPTION`` 0x22009806 :class:`ToasterBox` will have a caption, with the possibility to set a title for the :class:`ToasterBox` frame, and a close box.
====================== ========== ================================
:param `closingstyle`: the closing style for :class:`ToasterBox`. Can be one of the
following bits:
==================== =========== ==================================================
Closing Styles Hex Value Description
==================== =========== ==================================================
``TB_ONTIME`` 0x1 :class:`ToasterBox` will close after a specified amount of time.
``TB_ONCLICK`` 0x2 :class:`ToasterBox` can be closed by clicking anywhere on the :class:`ToasterBox` frame.
==================== =========== ==================================================
:param `scrollType`: the scrolling direction for :class:`ToasterBox`. Can be one of the
following bits:
==================== =========== ==================================================
Scroll Styles Hex Value Description
==================== =========== ==================================================
``TB_SCR_TYPE_UD`` 0x1 :class:`ToasterBox` will scroll from up to down
``TB_SCR_TYPE_DU`` 0x2 :class:`ToasterBox` will scroll from down to up
``TB_SCR_TYPE_FADE`` 0x4 :class:`ToasterBox` will fade in/out (without scrolling).
==================== =========== ==================================================
.. method:: AddPanel(self, panel)
Adds a panel to the :class:`ToasterBox`.
:param `panel`: an instance of :class:`wx.Window`.
.. note:: Use this method only for a :class:`ToasterBox` created with the ``TB_COMPLEX`` style.
.. method:: CenterOnParent(self, direction=wx.BOTH)
Centres the window on its parent (if any). If the :class:`ToasterBox` parent is ``None``,
it calls :meth:`~ToasterBox.CenterOnScreen`.
:param `direction`: specifies the direction for the centering. May be ``wx.HORIZONTAL``,
``wx.VERTICAL`` or ``wx.BOTH``.
.. note:: This methods provides for a way to center :class:`ToasterBox` over their parents instead of the
entire screen. If there is no parent, then behaviour is the same as :meth:`~ToasterBox.CenterOnScreen`.
.. seealso:: :meth:`~ToasterBox.CenterOnScreen`.
.. method:: CenterOnScreen(self, direction=wx.BOTH)
Centres the :class:`ToasterBox` on screen.
:param `direction`: specifies the direction for the centering. May be ``wx.HORIZONTAL``,
``wx.VERTICAL`` or ``wx.BOTH``.
.. seealso:: :meth:`~ToasterBox.CenterOnParent`.
.. method:: CleanList(self)
Cleans the window list, erasing the stack of :class:`ToasterBox` objects.
.. method:: GetToasterBoxWindow(self)
Returns the :class:`ToasterBox` frame.
.. method:: GetUseFocus(self)
Returns whether :class:`ToasterBox` will steal the focus from the parent application.
.. method:: MoveAbove(self, tb)
If a :class:`ToasterBox` already exists, move the new one above the existing one.
:param `tb`: another instance of :class:`ToasterBox`.
.. method:: Notify(self)
It's time to hide a :class:`ToasterBox`.
.. method:: OnMoveTimer(self, event)
Handles the ``wx.EVT_TIMER`` event for :class:`ToasterBox`, moving the new window
on top of the last one created.
:param `event`: a :class:`TimerEvent` event to be processed.
.. method:: Play(self)
Creates the :class:`ToasterBoxWindow`, that does all the job.
.. method:: SetPopupBackgroundColour(self, colour=None)
Sets the :class:`ToasterBox` background colour.
:param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, then
the background colour will be white.
.. note:: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.
.. method:: SetPopupBitmap(self, bitmap=None)
Sets the :class:`ToasterBox` background image.
:param `bitmap`: a valid :class:`wx.Bitmap` object or filename. If defaulted
to ``None``, then no background bitmap is used.
.. note:: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.
.. method:: SetPopupPauseTime(self, pausetime)
Sets the time after which the :class:`ToasterBox` is destroyed (linger).
:param `pausetime`: the delay after which the control is destroyed, in seconds.
.. method:: SetPopupPosition(self, pos)
Sets the :class:`ToasterBox` position on screen.
:param `pos`: the widget position, an instance of :class:`wx.Point`.
.. method:: SetPopupPositionByInt(self, pos)
Sets the :class:`ToasterBox` position on screen, at one of the screen corners.
:param `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
============= ========================================
.. method:: SetPopupScrollSpeed(self, speed)
Sets the :class:`ToasterBox` scroll speed.
:param `speed`: it is the pause time (in milliseconds) for every step in the
`ScrollUp` method.
.. method:: SetPopupSize(self, size)
Sets the :class:`ToasterBox` size.
:param `size`: the new control size, an instance of :class:`wx.Size`.
.. method:: SetPopupText(self, text)
Sets the :class:`ToasterBox` text label.
:param `text`: the widget label.
.. note:: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.
.. method:: SetPopupTextColour(self, colour=None)
Sets the :class:`ToasterBox` foreground colour.
:param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, then
the background colour will be black.
.. note:: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.
.. method:: SetPopupTextFont(self, font=None)
Sets the :class:`ToasterBox` text font.
:param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, then
a simple generic font will be generated.
.. note:: Use this method only for a :class:`ToasterBox` created with the ``TB_SIMPLE`` style.
.. method:: SetTitle(self, title)
Sets the :class:`ToasterBox` title if it was created with ``TB_CAPTION`` window style.
:param `title`: the :class:`ToasterBox` caption title.
.. method:: SetUseFocus(self, focus)
If `focus` is ``True``, Instructs :class:`ToasterBox` to steal the focus from the
parent application, otherwise it returns the focus to the original owner.
:param `focus`: ``True`` to set the focus on :class:`ToasterBox`, ``False`` to
return it to the original owner.