2024-06-28 15:12:45 发布
网友
我想用Python为eOS Luna上的万神殿面板制作一个简单的applet。我找不到任何API的文档。在一些论坛上有人建议我应该使用与Gnome或Unity相同的程序。不过,我尝试过的小程序(比如this answer)根本就不起作用。在
你能告诉我我该怎么做才能在万神殿面板上显示一个简单的小程序图标+菜单吗?在
根据Ubuntu文档,似乎必须使用appindicator模块。PyGtk的appindicator包没有成功,但据我所知,PyGi AppIndicator3确实工作得很好。在
appindicator
AppIndicator3
一个简单的例子是:
#!/usr/env/bin/ python from gi.repository import Gtk from gi.repository import AppIndicator3 as appindicator def menuitem_response(w, buf): print buf if __name__ == "__main__": ind = appindicator.Indicator.new ( "example-simple-client", "indicator-messages", appindicator.IndicatorCategory.APPLICATION_STATUS) ind.set_status (appindicator.IndicatorStatus.ACTIVE) ind.set_attention_icon ("indicator-messages-new") menu = Gtk.Menu() for i in range(3): buf = "Test-undermenu - %d" % i menu_items = Gtk.MenuItem(buf) menu.append(menu_items) menu_items.show() ind.set_menu(menu) Gtk.main()
来自here的示例。在
根据Ubuntu文档,似乎必须使用appindicator模块。PyGtk的
appindicator
包没有成功,但据我所知,PyGiAppIndicator3
确实工作得很好。在一个简单的例子是:
来自here的示例。在
相关问题 更多 >
编程相关推荐