from PyQt4 import QtCore QtGui from PyQt4 QtCore import SIGNAL SLOT QO

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import SIGNAL, SLOT, QObject, QVariant
class App(QtGui.QWidget):
def __init__(self, parent=None):
# всякая инициализация
# self.trayMenu = QtGui.QMenu(self)
# заполнить меню
ico=QtGui.QIcon(':/img/libru_gr.svg') # ":" - из ресурса, иначе указать отн. путь
self.tray=QtGui.QSystemTrayIcon(self)
self.tray.setIcon(ico)
self.tray.setContextMenu(self.trayMenu)
QObject.connect(self.tray, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.onTray)
self.setWindowIcon(ico) # app window icon