我想在不重新打开托盘的情况下更改 pystray 的图像
icon = Icon('name',Image,'other name',(MenuItem('open',open),MenuItem('exit',_exit_)))
icon.run()
icon.stop()
icon = Icon('name',other Image,'other name',(MenuItem('open',open),MenuItem('exit',_exit_)))
icon.run()
我也无法退出脚本,我正在使用
from os import exit
exit 它给了我这个错误
An error occurred when calling message handler
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pystray\_win32.py", line 402, in _dispatcher
uMsg, lambda w, l: 0)(wParam, lParam) or 0)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pystray\_win32.py", line 213, in _on_notify
descriptors[index - 1](self)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pystray\_base.py", line 324, in inner
callback(self)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pystray\_base.py", line 449, in __call__
return self._action(icon, self)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pystray\_base.py", line 544, in wrapper0
return action()
File "c:/Users/lenovo/Desktop/clauth.py", line 1069, in c82
c77()
File "c:/Users/lenovo/Desktop/clauth.py", line 1078, in c77
exit(1)
SystemExit: 1
任何帮助将不胜感激
我知道我无法更改托盘图像,唯一的方法是像上面的代码一样停止。 但请