开发者

Minimize python to system tray in Windows (Vista)

I would like to know if it is possible to minimise my python program to the system tray. Basically what it does is at ev开发者_如何学运维ery hour it takes a screenshot but I don't want it to stay on the task bar taking space. Could I make it go to the system tray area next to the clock but keep it running? I am not using tkinter or anything like that.


Since you are running on Windows, you may simply want to rename your script to have a .pyw extension, so there is no console window. If you try to make a system tray application, you will need to pick a GUI toolkit like you've suggested, and your simple script will become a LOT bigger and far more complicated.


Seems like some rather helpful folk here...

I was curious myself, and am poring over this persons PyWin32 app which might help your cause, Matthew:

http://www.brunningonline.net/simon/blog/archives/SysTrayIcon.py.html


As opposed to having the program running continuously, why don't you use your system's scheduler? (Cron under *nix, Task Scheduler under windows). There might be a bit more overhead since it has to spin up Python each time, but it would be easier than hooking up a notification icon.

Since you refer to it as the task bar, I assume Windows. To have a notification icon, you would have to have a hidden window, with a running message pump, so Windows has somewhere to send messages to for the icon.

So, in short, much simpler just running a scheduled job.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜