我在这里找到了一个python scrypt:ubuntu App Developer:应用程序指示器可以做一个指示器App,然后我对其进行了一些微调,并做了一个litle Lang标志指示器。
国家指标
#!/usr/bin/env python
# Copyright 2009 Canonical Ltd.
#
# Authors: Neil Jagdish Patel <neil.patel@canonical.com>
# Jono Bacon <jono@ubuntu.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of either or both of the following licenses:
#
# 1) the GNU Lesser General Public License version 3, as published by the
# Free Software Foundation; and/or
# 2) the GNU Lesser General Public License version 2.1, as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the applicable version of the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of both the GNU Lesser General Public
# License version 3 and version 2.1 along with this program. If not, see
# <http://www.gnu.org/licenses/>
#
import gtk
import appindicator
import getpass
import locale
lang = locale.getdefaultlocale()
user = getpass.getuser()
png = '/home/' + user + '/.icons/flags/' + lang[0] + '.png'
def menuitem_response(w):
gtk.main_quit()
if __name__ == "__main__":
ind = appindicator.Indicator ("lang-flag-indicator", png, appindicator.CATEGORY_APPLICATION_STATUS)
ind.set_status (appindicator.STATUS_ACTIVE)
print "your current language is: %s, so it load the ~/.icons/flags/%s.png" % (lang[0], lang[0])
# create a menu
menu = gtk.Menu()
mnuQuit = gtk.MenuItem("Exit")
menu.append(mnuQuit)
mnuQuit.connect("activate", menuitem_response)
mnuQuit.show()
ind.set_menu(menu)
gtk.main()
它可以作为Python scrypt轻松运行,也可以使用pyinstaller进行编译
希望这可以帮助