On Mar 30, 3:50 pm, Benjamin <[EMAIL PROTECTED]> wrote:
> On Mar 29, 11:02 pm, Alex Teiche <[EMAIL PROTECTED]> 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:
>
> >http://doc.trolltech.com/4.3/qsystemtrayicon.html
>
> > 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(self.tr("&Quit"), self)
QtCore.QObject.connect(self.quitAction,
QtCore.SIGNAL("triggered()"), QtGui.qApp, QtCore.SLOT("quit()"))
create_tray_icon()
self.composeAction.setEnabled(visible)
QtGui.QWidget.setVisible(self, visible)
self.trayIcon.show()
def create_tray_icon(self):
self.trayIconMenu = QtGui.QMenu(self)
self.trayIconMenu.addAction(self.composeAction)
self.trayIcon = QtGui.QSystemTrayIcon(self)
self.trayIcon.setContextMenu(self.trayIconMenu)
self.trayIcon.setIcon(bad.svg)
app = QtGui.QApplication(sys.argv)
sys.exit(app.exec_())
--
http://mail.python.org/mailman/listinfo/python-list