4

I am looking for a way to create appmenu indicator using python3.2 and pyqt4. Please help me.

0

1 Answer 1

4

Short: Ubuntu 11.10 ships a patched QT that will make a QSystemTrayIcon create an indicator if possible. In older Ubuntu versions you will need a patched version of Qt, and this will make your program a pain to distribute.

Long: There is a patch provided by Canonical to use indicators in Qt, but it's not yet integrated in the official Qt release and it's not likely to happen before Qt 5. Sources: The author blog, an post in the Qt forum from a Nokia/Trolltech developer.

Ubuntu 11.10 ships with this patch enabled, so a code like this will create an indicator if used in 11.10

import sys
from PyQt4 import QtGui

app = QtGui.QApplication([])
icon = QtGui.QSystemTrayIcon(QtGui.QIcon("test.png"), app)
menu = QtGui.QMenu()
menu.addAction("Quit", QtGui.qApp.quit)
icon.setContextMenu(menu)
icon.show()
app.exec_()

You will need a suitable icon in test.png.

Note that KDE (not plain QT) apps already support indicator by using kdelibs.

There is also the libindicate-qt project, but I can't find python biddings for it nor any documentation.

1
  • Be sure to install the sni-qt package for this to work. Note that libindicate-qt is not about appindicators: it is mainly used by applications to integrate into the messaging menu (example users include Quassel, Konversation, Kopete and KMail) Nov 2, 2011 at 15:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .