我是 Python 和 GUI 编程的新手。我试图通过做一个小应用程序来学习两者。在我的应用程序中,后台进程应该始终运行并通过 appindicator 显示用户的一些虚构配额。这是我的代码:
#!/usr/bin/env python
import pyjsonrpc
from gi.repository import Gtk
from gi.repository import AppIndicator3 as appindicator
import thread
import glib
ind = None
def start_gtk_main():
ind = appindicator.Indicator.new(
"example-simple-client",
"indicator-messages",
appindicator.IndicatorCategory.APPLICATION_STATUS)
ind.set_status (appindicator.IndicatorStatus.ACTIVE)
ind.set_label('NA', '')
menu = Gtk.Menu()
menu_quit = Gtk.MenuItem("Quit")
menu_quit.connect("activate", quit_app)
menu.append(menu_quit)
menu_quit.show()
ind.set_menu(menu)
try:
thread.start_new_thread(update_ind_label, ())
except:
print "Error: unable to start thread"
Gtk.main()
def quit_app(self):
Gtk.main_quit()
def update_ind_label():
value = glib.timeout_add_seconds(5, handler_timeout)
def handler_timeout():
url = "http://localhost/jsonrpc-server/"
http_client = pyjsonrpc.HttpClient(url)
response …Run Code Online (Sandbox Code Playgroud) 升级到 Ubuntu 17.04 后,Electron 应用程序的 AppIndicators 不再工作。例如,我看不到 Discord AppIndicator。
通常在使用我的笔记本电脑时,在 Maverick 中,电池图标用于显示在面板中,为我指示电池状态,并允许我设置机器的性能,如性能、正常、按需、节能等。
但是,我在戴尔 inspiron 1525 上安装了 Ubuntu natty,但它没有在面板上显示任何电池信息。这可以从下面的屏幕截图中看出..

Natty 有默认的电池指示器吗?
安装 Cairo-dock 后,当我重新启动笔记本电脑时,蓝牙指示灯消失了。蓝牙工作正常。但是面板左上角的蓝牙指示灯不再显示。我必须转到系统设置>蓝牙才能添加/删除蓝牙设备。如何带回蓝牙指示灯?
/etc/xdg/autostart/bluetooth-applet.desktop并且/etc/xdg/autostart/bluetooth-applet-unity.desktop存在不知何故,我设法从我的系统托盘中删除了日期和时间小部件。我如何取回它?“日期和时间”也不再出现在系统设置中。
我正在运行 Ubuntu 11.10。
我有 coinprice-indicator,它是一个指标小程序,使用 Kraken、BitStamp 或 BTC-E 的 API 显示 BTC 的价格。它刷新表单 3 到每 60 秒。
我使用 make 从控制台启动这个小程序,但是如果我关闭控制台,指示器小程序也会关闭(ofc)。
我怎样才能让这个指标小程序从启动时打开?