<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
'activated' is a signal of QSystemTrayIcon.<br>
you have to connect it to a slot (the onTrayIconActivated method in
this case) in order to catch it.<br>
i highly suggest this reading before step forward:<br>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#new-style-signal-and-slot-support">http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#new-style-signal-and-slot-support</a><br>
<br>
minimal working example here:<br>
<br>
import sys<br>
from PyQt4.QtCore import * <br>
from PyQt4.QtGui import * <br>
<br>
class MainWindow(QMainWindow):<br>
<br>
def __init__(self, parent=None):<br>
super(MainWindow, self).__init__(parent)<br>
<br>
self.trayIcon = QSystemTrayIcon(self)<br>
self.trayIcon.activated.connect(self.onTrayIconActivated)<br>
self.trayIcon.show()<br>
<br>
def onTrayIconActivated(self, reason):<br>
if reason == QSystemTrayIcon.DoubleClick:<br>
print 'tray icon double clicked'<br>
<br>
if __name__ == "__main__": <br>
app = QApplication(sys.argv) <br>
w = MainWindow() <br>
w.show() <br>
sys.exit(app.exec_())<br>
<br>
<br>
hope it helps<br>
<br>
bests<br>
Zoltan<br>
<br>
<br>
<br>
On 2010.11.08. 15:54, Jebagnana Das wrote:
<blockquote
cite="mid:AANLkTinZPo03RjDT4L4aqcuM3aUbhuCkDpupJj3qavvi@mail.gmail.com"
type="cite">Hello all,<br>
<br>
Based on this example <a moz-do-not-send="true"
href="http://www.saltycrane.com/blog/2008/01/how-to-capture-tab-key-press-event-with/">http://www.saltycrane.com/blog/2008/01/how-to-capture-tab-key-press-event-with/</a>
i've created a class as below<br>
<br>
class SystemTrayIcon(QtGui.QSystemTrayIcon):<br>
<br>
def __init__(self,parent,objectName):<br>
<br>
QtGui.QSystemTrayIcon.__init__(self,parent)<br>
<br>
self.setObjectName(objectName)<br>
<br>
print("Tray icon created")<br>
<br>
def activated(self,reason):<br>
<br>
if reason==QtGui.QSystemTrayIcon.DoubleClick:<br>
<br>
print("Tray icon Double clicked")<br>
<br>
After creating an object for this class when i double click the
tray icon nothing happens. Any idea of what am i missing here??
Thanks..<br>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PyQt mailing list <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
</blockquote>
<br>
</body>
</html>