API reference

This page contains documentation of all methods available in zroya.

zroya.TrayIcon TrayIcon represents an application icon.
zroya.TrayIcon.create Shows notification.
zroya.TrayIcon.update Polls all waiting events.
zroya.TrayIcon.quit Ends notification event loop.

Methods

class zroya.TrayIcon

TrayIcon represents an application icon. You may add one bubble notification.

create(title, message, icon=None, sound=True, on_click=None, on_show=None, on_hide=None)

Shows notification. All callback functions take two parameters. First one is integer with notification ID, second is dict with parameters used for creation (title, message, icon).

Parameters:
  • title (str) – Notification title.
  • message (str) – Short notification text.
  • icon (str/int) – Path to the icon file or one of TrayIcon.ICON_*. Use None for info icon.
  • sound (bool) – Should sound be played when notification appears?
  • on_click (callable) – On click callback. Called when user clicks on notification.
  • on_show (callable) – On show callback. Called when notification is shown.
  • on_hide (callable) – On hide callback. Called when notification is hidden by user.
Returns:

Notification ID.

hide()

Remove notification. If notification was not shown yet, return false. :return: True if notification was hidden, False otherwise.

quit()

Ends notification event loop.

Returns:Nothing.
update()

Polls all waiting events. This function should be called periodically in event loop. It polls all waiting events from queue and calls corresponding callbacks.

Returns:False when notification center was shut down. True otherwise.