Reputation: 21
I have tkinter app which I am trying to add pystary icon. I just implemented it successfully. But I want to call "show window" method from another class not only from the menu item of pystray. But in order to do that I have to pass icon parameter. How can I call this method from outside?
def hide_window():
root.withdraw()
image = Image.open("statics/icon.ico")
menu = (item('Open App', show_window), item('Exit', quit_window))
icon = pystray.Icon("name", image, "Tax Status Checker", menu)
icon.run()
def show_window(icon):
icon.stop()
root.deiconify()
def quit_window(icon):
icon.stop()
root.destroy()
I don't know how to approach or change code structure.
Upvotes: 2
Views: 181