A Python module to interact with the Windows tray.
pip3 install ptray
pip3 install git+https://github.com/donno2048/pytray
Here is a simple example:
import pytray, time, os
pytray.create_tray_element()
pytray.create_menu(
("Exit", 1), ("Close", 2)
)
pytray.add_icon()
i = 0
while True:
start_time = time.time()
while time.time() - start_time < 0.3:
click = pytray.what_is_clicked()
if click == 1:
exit()
elif click == 2:
pytray.hide_menu()
elif click == None:
pass
time.sleep(0.1) # make sure only one click is registered
pytray.set_icon(os.path.abspath(f"cat\\{i}.ico")) # requires the cat directory from this repo (by Kyome22)
i = (i + 1) % 5