I need the program to be opened by double clicking on the tray icon.
Like this:
def show(icon, item):
icon.stop()
root.after(0, root.deiconify())
icon = pystray.Icon("name", image, "Title", menu)#, doubleclick=show())
icon.run()
I need the program to be opened by double clicking on the tray icon.
Like this:
def show(icon, item):
icon.stop()
root.after(0, root.deiconify())
icon = pystray.Icon("name", image, "Title", menu)#, doubleclick=show())
icon.run()
Copyright © 2021 Jogjafile Inc.
Unfortunately according to its own docs,
pystray
cannot listen for click or double-click events on the icon itself, presumably because there is no system-independent way to do it. This is also a limitation of the other system tray Python library,infi.systray
.Your example is not runnable, so I expanded on it. This snippet can run, and uses the standard device-independent drop-down menu method to start your tkinter app: