Using QSystemTrayIcon with PyQt

Alex Teiche xelapond at
Mon Mar 31 20:49:21 CEST 2008

On Mar 30, 3:50 pm, Benjamin <musiccomposit... at> wrote:
> On Mar 29, 11:02 pm, Alex Teiche <xelap... at> wrote:> Hello,
> > I am pretty new to Python, and have never learned C++.  I am trying to
> > implement the following thing into my python application:
> >
> > Through PyQt.  I have been using PyQt for awhile and I know how do use
> > it, but I could not get this specific thing to work.  Can someone give
> > me some hints as to get it working in Python?
> What problems are you having?
> > Thanks a ton,
> > Alex

Thanks everyone for your help.  I found the example to be particularly
helpful, and I have made a simplified version just to display an icon
with a quit button in its menu.  Once I know how to do that I will
incorporate it into my larger program, with more options and the
ability show messages.  The problem is, it doesn't work, and I can't
find out what's wrong.  Can you give me some hints?

Here is the code:
import sys
from PyQt4 import QtGui, QtCore

class trayIcon(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

	#********Create Actions for the Tray Menu********#
	self.quitAction = QtGui.QAction("&Quit"), self)
QtCore.SIGNAL("triggered()"), QtGui.qApp, QtCore.SLOT("quit()"))


	QtGui.QWidget.setVisible(self, visible)

    def create_tray_icon(self):
         self.trayIconMenu = QtGui.QMenu(self)
         self.trayIcon = QtGui.QSystemTrayIcon(self)

app = QtGui.QApplication(sys.argv)

More information about the Python-list mailing list