3

I am working on creating a tkinter window when the pystray icon is pressed so I can make my own Menu in the tray. But I have no idea how to get if the tray icon is pressed. Any help is appreciated! Thanks in advance!

vSteppY
  • 31
  • 3

1 Answers1

5

You can use something like

icon = pystray.Icon(name="exampleapp",icon=image,title="Example",menu=pystray.Menu(
    pystray.MenuItem(text="Left-Click-Action",action=default_function,default=True),
    pystray.MenuItem(text="Other option",other_function)
))

So you can set the default parameter from a pystray.MenuItem object to True to make it the left-click function.