简体   繁体   中英

Python-Tkinter:how to highlight item on taskbar on windows xp when window is minimized to the taskbar

i am using python/tkinter to write a IM software on XP. now i've got all the main functions done except i don't know how to highlight or change colour my IM item on taskbar on windows xp when window is minimized to the taskbar when a new message is received. i've search for this but just got c# solution. i need help on python. thanks!

I needed to do this for a tkinter python slack client I am writing and found http://wiki.tcl.tk/1049 . After a bit of guessing, I found that

Tk().deiconify()
Tk().focus_force()

(ie on the root window) does the trick. Windows doesn't actually change the focus and show the window since applications are not allowed to do that (Windows after XP) but it flashes the taskbar instead. It will keep flashing until clicked on but that seems to be the behaviour of Skype/Slack etc. Certainly close enough for many uses.

Obviously this is an old question but I couldn't find a concise, python only, answer and still needed one!

I'm not sure if there is a good way of doing this with Tk. Maybe somebody more knowledgeable will be able to point you in a better direction. Since Python is so dependent on OO, you may have a difficult time writing bindings to the Windows window manager.

If you don't find anything else, I did stumble on http://wiki.tcl.tk/4089 , which manages Windows icons on the taskbar. Perhaps you could utilize this to simulate the taskbar flash that you want?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM