Ubuntu System Tray in Python
How do I put a program in the system tray (I don't think it's calle开发者_如何学Pythond like that in Linux) in python TKINTER for UBUNTU 9.04.
I don't believe you can do that using Tkinter. You will have to use the gtk libraries.
An example, found on a Ubuntu forum: http://ubuntuforums.org/showpost.php?s=bc369fc9343ae728577f1bdcd292caca&p=1053546&postcount=3
Here's an example (in Perl) of combining gtk and Tk. Gtk handles the tray icon, and the rest of the app uses Tk: http://www.perlmonks.org/?node_id=626617
You have to use GTK. Do note that Ubuntu 10.04+ has a new, incompatible system tray. It's called AppIndicator; there's a python example here: https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators#Python%20version
There is the sytem tray protocol, which I believe both gnome and kde use. You might be able to use it straight from python using ctype to call X11 methods. But I would go with the GTK solution.
精彩评论