tkinter.systray System tray icon and notifications
Source code: Lib/tkinter/systray.py
Added in version 3.16.
The tkinter.systray module provides the SysTrayIcon class
as an interface to the system tray (or taskbar) icon,
and the notify() function which sends a desktop notification.
They require Tk 8.7/9.0 or newer.
Only one system tray icon is supported per Tcl interpreter.
- class tkinter.systray.SysTrayIcon(master=None, *, exists=False, **options)
The class implementing the system tray icon.
With exists false (the default), a new icon is created; creating a second one raises
TclError. With exists true, the instance refers to the already-existing icon instead of creating one, reconfiguring it with any given options.The supported configuration options are:
image the image displayed in the system tray (required when creating an icon). On Windows, it must be a
PhotoImage.text the text displayed in the tooltip of the icon.
button1 a callback that is called without arguments when the icon is clicked with the left mouse button.
button3 a callback that is called without arguments when the icon is clicked with the right mouse button.
- tkinter.systray.notify(title, message, *, master=None)
Send a desktop notification with the given title and message without creating a system tray icon first. On Windows, sending a notification requires an existing system tray icon, which is also displayed in the notification; use the
SysTrayIcon.notify()method instead.