我用python为Ubuntu编写了一个简单的指示器applet地理信息库我已经在我的ubuntu14.04上成功运行了很长时间,没有任何问题。在我更新到Ubuntu16.04之后,我开始看到一些奇怪的行为。我在Ubuntu14.04上又试了一次,只是为了确保它能正常工作,但是在Ubuntu16.04上,我的菜单事件不会被触发,当我试图改变图标时,应用程序有时也不会响应。在
一些基本的代码指示符,可以在Ubuntu14.04上工作,但在Ubuntu16.04上不行
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as appindicator
def main():
indicator = appindicator.Indicator.new(
'mytestindicator',
gtk.STOCK_INFO,
appindicator.IndicatorCategory.SYSTEM_SERVICES
)
indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
indicator.set_menu(build_menu())
gtk.main()
def quit(source):
gtk.main_quit()
def build_menu():
menu = gtk.Menu()
item_quit = gtk.MenuItem('Quit')
item_quit.connect('activate', quit)
menu.append(item_quit)
menu.show_all()
return menu
if __name__ == '__main__':
main()
所以我的问题是ubuntu14.04和16.04之间发生了什么变化,如何创建一个可靠的指示器applet,在两个系统上都能平稳运行?在
但有一件事我注意到了,在Ubuntu14上地理信息库版本3.12.0,但在Ubuntu16上是3.20.0,但这并不重要。在
正如我们所讨论的:
相关问题 更多 >
编程相关推荐