[英]wxPython Changing Taskbar Icon During Runtime Windows
I have main.py and appIndicator.py files. 我有main.py和appIndicator.py文件。 I start appIndicator.py(which use wxPython library) from main.py as subprocess. 我从main.py作为子进程启动appIndicator.py(使用wxPython库)。 When I have notificaion, I have to change appIndicator icon. 收到通知后,我必须更改appIndicator图标。 However, I couldn't find any way to do that so when I need to change appIndicator icon, I kill subprocess from main.py, change icon file and start appIndicator as subprocess again but in Windows, when I do that, appIndicator icon is duplicated. 但是,我找不到任何方法来执行此操作,因此当我需要更改appIndicator图标时,我从main.py中杀死了子进程,更改了图标文件并再次将appIndicator作为子进程启动,但是在Windows中,当我这样做时,appIndicator图标是复制。 Till the I take mouse pointer on old subprocess' icon, it stays there. 直到我将鼠标指针停留在旧子进程的图标上,它才会停留在该位置。
Is there any better way to change icon ? 有没有更好的方法来更改图标?
What should I do to be able to clear old icon ? 我应该怎么做才能清除旧图标?
Do you have any different suggestion ? 你有什么不同的建议吗?
Thanks... 谢谢...
In your change icon event handler, try calling the current icon's RemoveIcon()
method and then its Destroy()
method. 在更改图标事件处理程序中,尝试调用当前图标的RemoveIcon()
方法,然后调用其Destroy()
方法。 That should remove it from the taskbar. 那应该将其从任务栏中删除。 Then you can create the new icon that should appear there. 然后,您可以创建应该在此处显示的新图标。 I believe you'll have to call the new icon's SetIcon()
method to make it appear in the system tray. 我相信您必须调用新图标的SetIcon()
方法才能使其出现在系统托盘中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.