I require a code, to launch tray icon and execute other parts of codes...
So for that I tried below:
from pystray import MenuItem as item
import pystray
from PIL import Image, ImageDraw
import time
def action():
pass
def exit(icon):
icon.stop()
image = Image.open("image.PNG")
menu = (item('name', action), item('Exit', exit))
icon = pystray.Icon("A", image, "B", menu)
i = 0
icon.run()
while i != 50:
print('test')
time.sleep(1)
i += 1
This launches the tray icon, but doesn't execute my loop. (it only executes post I stop the Icon)