我想使用单个指标类创建两个或更多面板指标。这是代码:
#!/usr/bin/env python
import os
from gi.repository import Gtk
from gi.repository import AppIndicator3
class IndicatorObject:
def create_indicator(self, indicator_id):
indicator = AppIndicator3.Indicator.new(indicator_id, os.path.abspath('sample_icon.svg'), AppIndicator3.IndicatorCategory.SYSTEM_SERVICES)
indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
menu = Gtk.Menu()
item_quit = Gtk.MenuItem('Quit')
menu.append(item_quit)
indicator.set_menu(menu)
menu.show_all()
print indicator_id
indicator1 = IndicatorObject()
indicator1.create_indicator("first_indicator")
indicator2 = IndicatorObject()
indicator2.create_indicator("second_indicator")
Gtk.main()
但是当我运行脚本时没有任何反应。如何使用单个类创建两个或多个指标?