[PyQt] Two problems with QSystemTrayIcon

duncan duncan duncan73 at gmail.com
Fri Mar 7 15:46:38 GMT 2008


Hello.

I am trying to put an icon into the system tray area using QSystemTrayIcon.
All work well except when I close the program.

I put the icon in the area using this code:

----
    icon=QtGui.QIcon("pixmaps/todo_list.png")
    systray=QtGui.QSystemTrayIcon(icon)
    #systray.setIcon(icon)
    menu = QtGui.QMenu()
    quitAction = menu.addAction('Quit')
    systray.setContextMenu(menu)
    quitAction.connect(quitAction, QtCore.SIGNAL("triggered()"),  ui.QuitApp
)
    systray.show()

    sys.exit(app.exec_())
-----

I have two minor problems:

1) when I close the program, the icon stay in the tray area until I move the
mouse pointer over it, at this point it go away
2) after exiting from the program, I get this error:
QApplication::qAppName: Please instantiate the QApplication object first

I have the feeling that the two problems are connected, but I cannot find a
clue

I am working with Qt 4.3.3 and PyQt4.3.3.2 under Windows XP

Any suggestions ?

thanks in advance
Gianluca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080307/c102dae2/attachment.html


More information about the PyQt mailing list