How to reproduce:
- Start python script, which uses
wx.adv.TaskBarIcon
- Connect second monitor with different magnification settings, which is set as “Make this my main display” in “Display settings”
- Tray icon will automatically move to a second monitor, but now you will notice that it is not responding to
wx.adv.TaskBarIcon.SetIcon(icon, title)
: icon and title will not change - If you exit script as usual, icon will not disappear until you mouse over it. In contrast, in a normal situation, when icon was not moved to a second monitor, it will appear at the moment when script finishes. This looks like
wx.adv.TaskBarIcon
destructor cannot remove icon because it loses connection to it
Important notice:
- Thankfully, this situation can be detected by calling
wx.adv.TaskBarIcon.IsIconInstalled
- which will return False in this problematic situation. Unfortunately, I do not know what to do in this situation - how to reattach to icon, or hide previous icon and create new. - As I connect to different monitors several times a day, every time script stops working correctly due to icon detached. I think this is normal situation to connect notebook to a monitor today.
Question:
- I tried calling
super(TaskBarIcon, self).__init__()
whenwx.adv.TaskBarIcon.IsIconInstalled
returns False and this creates new correctly attached icon, but it does not hide previous icon.RemoveIcon()
also does not remove this detached icon.
How this can be fixed?