# `!tkinter.systray` --- System tray icon and notifications

<div class="module" data-synopsis="System tray icon and desktop notifications">

tkinter.systray

</div>

**Source code:** `Lib/tkinter/systray.py`

<div class="versionadded">

3.16

</div>

------------------------------------------------------------------------

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.

<div class="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 `~tkinter.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.

<div class="method">

configure(**options) config(**options)

Query or modify the options of the system tray icon. With no arguments, return a dict of all option values. With a string argument, return the value of that option. Otherwise, set the given options.

</div>

<div class="method">

cget(option)

Return the value of the given option of the system tray icon.

</div>

<div class="method">

exists()

Return whether the system tray icon exists.

</div>

<div class="method">

destroy()

Destroy the system tray icon. A new icon can be created afterwards.

</div>

<div class="method">

notify(title, message)

Send a desktop notification with the given title and message.

</div>

</div>

<div class="function">

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.

</div>