9

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!

1
  • Please provide enough code so others can better understand or reproduce the problem. Commented Jul 30, 2022 at 18:01

1 Answer 1

13

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.