.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.adv.NotificationMessage:
==========================================================================================================================================
|phoenix_title| **wx.adv.NotificationMessage**
==========================================================================================================================================
This class allows to show the user a message non intrusively.
Currently it is implemented natively for Windows and GTK and uses (non-modal) dialogs for the display of the notifications under the other platforms.
Notice that this class is not a window and so doesn't derive from :ref:`wx.Window`.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
NotificationMessage:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.adv.NotificationMessage.__init__` Default constructor, use :meth:`~NotificationMessage.SetParent` , :meth:`~NotificationMessage.SetTitle` and :meth:`~NotificationMessage.SetMessage` to initialize the object before showing it.
:meth:`~wx.adv.NotificationMessage.Close` Hides the notification.
:meth:`~wx.adv.NotificationMessage.SetFlags` This parameter can be currently used to specify the icon to show in the notification.
:meth:`~wx.adv.NotificationMessage.SetMessage` Set the main text of the notification.
:meth:`~wx.adv.NotificationMessage.SetParent` Set the parent for this notification: the notification will be associated with the top level parent of this window or, if this method is not called, with the main application window by default.
:meth:`~wx.adv.NotificationMessage.SetTitle` Set the title, it must be a concise string (not more than 64 characters), use :meth:`~NotificationMessage.SetMessage` to give the user more details.
:meth:`~wx.adv.NotificationMessage.Show` Show the notification to the user and hides it after `timeout` seconds are elapsed.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.adv.NotificationMessage(EvtHandler)
**Possible constructors**::
NotificationMessage()
NotificationMessage(title, message="", parent=None,
flags=ICON_INFORMATION)
This class allows to show the user a message non intrusively.
.. method:: __init__(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**__init__** `(self)`
Default constructor, use :meth:`SetParent` , :meth:`SetTitle` and :meth:`SetMessage` to initialize the object before showing it.
**~~~**
**__init__** `(self, title, message="", parent=None, flags=ICON_INFORMATION)`
Create a notification object with the given attributes.
See :meth:`SetTitle` , :meth:`SetMessage` , :meth:`SetParent` and :meth:`SetFlags` for the description of the corresponding parameters.
:param `title`:
:type `title`: string
:param `message`:
:type `message`: string
:param `parent`:
:type `parent`: wx.Window
:param `flags`:
:type `flags`: int
**~~~**
.. method:: Close(self)
Hides the notification.
Returns ``True`` if it was hidden or ``False`` if it couldn't be done (e.g. on some systems automatically hidden notifications can't be hidden manually).
:rtype: `bool`
.. method:: SetFlags(self, flags)
This parameter can be currently used to specify the icon to show in the notification.
Valid values are ``ICON_INFORMATION`` , ``ICON_WARNING`` and ``ICON_ERROR`` (notice that ``ICON_QUESTION`` is not allowed here). Some implementations of this class may not support the icons.
:param `flags`:
:type `flags`: int
.. method:: SetMessage(self, message)
Set the main text of the notification.
This should be a more detailed description than the title but still limited to reasonable length (not more than 256 characters).
:param `message`:
:type `message`: string
.. method:: SetParent(self, parent)
Set the parent for this notification: the notification will be associated with the top level parent of this window or, if this method is not called, with the main application window by default.
:param `parent`:
:type `parent`: wx.Window
.. method:: SetTitle(self, title)
Set the title, it must be a concise string (not more than 64 characters), use :meth:`SetMessage` to give the user more details.
:param `title`:
:type `title`: string
.. method:: Show(self, timeout=Timeout_Auto)
Show the notification to the user and hides it after `timeout` seconds are elapsed.
Special values ``Timeout_Auto`` and ``Timeout_Never`` can be used here, notice that you shouldn't rely on `timeout` being exactly respected because the current platform may only support default timeout value and also because the user may be able to close the notification.
:param `timeout`:
:type `timeout`: int
:rtype: `bool`
:returns:
``False`` if an error occurred.
.. note::
When using native notifications in wxGTK, the timeout is ignored for the notifications with ``ICON_WARNING`` or ``ICON_ERROR`` flags, they always remain shown unless they're explicitly hidden by the user, i.e. behave as if Timeout_Auto were given.