Python中的Ubuntu系统托盘

2024-04-16 21:29:32 发布

您现在位置:Python中文网/ 问答频道 /正文

如何在PythonTkinter中为Ubuntu9.04将程序放入系统托盘(我不认为Linux中是这样调用的)。


Tags: 程序linux系统托盘pythontkinter
3条回答

我不相信你能用Tkinter做到。你必须使用gtk库。

一个例子,可以在Ubuntu论坛上找到:http://ubuntuforums.org/showpost.php?s=bc369fc9343ae728577f1bdcd292caca&p=1053546&postcount=3

下面是一个结合gtk和Tk的例子(在Perl中)。Gtk处理托盘图标,其余的应用程序使用Tk:http://www.perlmonks.org/?node_id=626617

这里有sytem tray protocol,我相信gnome和kde都使用它。您可以直接从python使用ctype调用X11方法。但我会采用GTK解决方案。

你必须使用GTK。请注意,Ubuntu 10.04+有一个新的,不兼容的系统托盘。它被称为AppIndicator;这里有一个python示例:https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators#Python%20version

相关问题 更多 >