Documentation¶
Package structure¶
trayicon
├── get_available_gui_toolkits (function)
├── gtkicon (module)
│ ├── SubMenu (class)
│ └── TrayIcon (class)
├── qticon (module)
│ ├── SubMenu (class)
│ └── TrayIcon (class)
└── tkicon (module)
├── SubMenu (class)
└── TrayIcon (class)
The SubMenu
and TrayIcon
classes of all three modules have in common the methods documented below.
The aim of this module is to enable a simple switching between toolkits, for instance to allow the end-users
to choose the toolkit best suited to their desktop environment.
get_available_gui_toolkits¶
TrayIcon¶
Warning
- The way the icon is displayed and integrated in the desktop environment varies depending on both the toolkit and the toolkit used by the desktop environment. Therefore, the same image might have a different rendering in the system tray depending on the toolkit (e.g. resizing issues).
- Click bindings might have different behavior depending on the GUI toolkit. For instance, click bindings do not work at all with the Gtk toolkit if AppIndicator3 is used.
-
class
TrayIcon
(icon, fallback_icon_path)¶ System tray icon.
-
__init__
(icon, fallback_icon_path)¶ - icon : str
- icon path or name (the Gtk and Qt system tray icons can fetch the icon from the current theme)
- fallback_icon_path : str
- path to image to use as icon if the first one fails (useful if the current theme does not have the desired icon for instance)
-
bind_left_click
(command)¶ Bind command to left click on the icon.
- command : function
- function executed on left click on the icon
-
bind_middle_click
(command)¶ Bind command to middle click on the icon.
- command : function
- function executed on middle click on the icon
-
bind_double_click
(command)¶ Bind command to double left click on the icon.
- command : function
- function executed on double left click on the icon
-
change_icon
(icon, desc='')¶ Change system tray icon.
- icon : str
- new icon path
- desc : str
- icon description, useful only for Gtk toolkit
-
loop
(tk_window)¶ Peridodically update the system tray icon inside tkinter mainloop.
- tk_window : Tk instance
- main GUI window
-