Re: Using QSystemTrayIcon with PyQt
On Apr 1, 6:00 am, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 7:53 pm, Benjamin [EMAIL PROTECTED] wrote: On Mar 31, 8:41 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 6:40 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 11:49 am, Alex Teiche [EMAIL PROTECTED] wrote: 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_()) OK, I messed around with it some more, and it works. I just don't know how to set an icon, and the example doesn't help at all. Here is the code: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(messageClicked()), self.messageClicked) #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(activated(QSystemTrayIcon::ActivationReason)), self.iconActivated) self.trayIcon.show() def createActions(self): #self.minimizeAction = QtGui.QAction(self.tr(Minimize), self) #QtCore.QObject.connect(self.minimizeAction, # QtCore.SIGNAL(triggered()), self, QtCore.SLOT(hide())) #self.maximizeAction = QtGui.QAction(self.tr(Maximize), self) #QtCore.QObject.connect(self.maximizeAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showMaximized())) #self.restoreAction = QtGui.QAction(self.tr(Restore), self) #QtCore.QObject.connect(self.restoreAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showNormal())) self.quitAction = QtGui.QAction(self.tr(Quit), self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL(triggered()), QtGui.qApp, QtCore.SLOT(quit())) def createTrayIcon(self): self.trayIconMenu = QtGui.QMenu(self) #self.trayIconMenu.addAction(self.minimizeAction) #self.trayIconMenu.addAction(self.maximizeAction) #self.trayIconMenu.addAction(self.restoreAction) #self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.quitAction) self.trayIcon = QtGui.QSystemTrayIcon(self) self.trayIcon.setContextMenu(self.trayIconMenu) app = QtGui.QApplication(sys.argv) x = Systray() sys.exit(app.exec_()) How would I go about setting the icon? Sorry, here is the code with commented out lines removed: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() self.trayIcon.show() def createActions(self): self.quitAction = QtGui.QAction(self.tr(Quit), self)
Re: Using QSystemTrayIcon with PyQt
On Apr 1, 7:56 am, BlueBird [EMAIL PROTECTED] wrote: On Apr 1, 6:00 am, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 7:53 pm, Benjamin [EMAIL PROTECTED] wrote: On Mar 31, 8:41 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 6:40 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 11:49 am, Alex Teiche [EMAIL PROTECTED] wrote: 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_()) OK, I messed around with it some more, and it works. I just don't know how to set an icon, and the example doesn't help at all. Here is the code: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(messageClicked()), self.messageClicked) #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(activated(QSystemTrayIcon::ActivationReason)), self.iconActivated) self.trayIcon.show() def createActions(self): #self.minimizeAction = QtGui.QAction(self.tr(Minimize), self) #QtCore.QObject.connect(self.minimizeAction, # QtCore.SIGNAL(triggered()), self, QtCore.SLOT(hide())) #self.maximizeAction = QtGui.QAction(self.tr(Maximize), self) #QtCore.QObject.connect(self.maximizeAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showMaximized())) #self.restoreAction = QtGui.QAction(self.tr(Restore), self) #QtCore.QObject.connect(self.restoreAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showNormal())) self.quitAction = QtGui.QAction(self.tr(Quit), self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL(triggered()), QtGui.qApp, QtCore.SLOT(quit())) def createTrayIcon(self): self.trayIconMenu = QtGui.QMenu(self) #self.trayIconMenu.addAction(self.minimizeAction) #self.trayIconMenu.addAction(self.maximizeAction) #self.trayIconMenu.addAction(self.restoreAction) #self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.quitAction) self.trayIcon = QtGui.QSystemTrayIcon(self) self.trayIcon.setContextMenu(self.trayIconMenu) app = QtGui.QApplication(sys.argv) x = Systray() sys.exit(app.exec_()) How would I go about setting the icon? Sorry, here is the code with commented out lines removed: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self)
Re: Using QSystemTrayIcon with PyQt
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
Re: Using QSystemTrayIcon with PyQt
On Mar 31, 11:49 am, Alex Teiche [EMAIL PROTECTED] wrote: 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_()) OK, I messed around with it some more, and it works. I just don't know how to set an icon, and the example doesn't help at all. Here is the code: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(messageClicked()), self.messageClicked) #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(activated(QSystemTrayIcon::ActivationReason)), self.iconActivated) self.trayIcon.show() def createActions(self): #self.minimizeAction = QtGui.QAction(self.tr(Minimize), self) #QtCore.QObject.connect(self.minimizeAction, # QtCore.SIGNAL(triggered()), self, QtCore.SLOT(hide())) #self.maximizeAction = QtGui.QAction(self.tr(Maximize), self) #QtCore.QObject.connect(self.maximizeAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showMaximized())) #self.restoreAction = QtGui.QAction(self.tr(Restore), self) #QtCore.QObject.connect(self.restoreAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showNormal())) self.quitAction = QtGui.QAction(self.tr(Quit), self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL(triggered()), QtGui.qApp, QtCore.SLOT(quit())) def createTrayIcon(self): self.trayIconMenu = QtGui.QMenu(self) #self.trayIconMenu.addAction(self.minimizeAction) #self.trayIconMenu.addAction(self.maximizeAction) #self.trayIconMenu.addAction(self.restoreAction) #self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.quitAction) self.trayIcon = QtGui.QSystemTrayIcon(self) self.trayIcon.setContextMenu(self.trayIconMenu) app = QtGui.QApplication(sys.argv) x = Systray() sys.exit(app.exec_()) How would I go about setting the icon? -- http://mail.python.org/mailman/listinfo/python-list
Re: Using QSystemTrayIcon with PyQt
On Mar 31, 6:40 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 11:49 am, Alex Teiche [EMAIL PROTECTED] wrote: 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_()) OK, I messed around with it some more, and it works. I just don't know how to set an icon, and the example doesn't help at all. Here is the code: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(messageClicked()), self.messageClicked) #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(activated(QSystemTrayIcon::ActivationReason)), self.iconActivated) self.trayIcon.show() def createActions(self): #self.minimizeAction = QtGui.QAction(self.tr(Minimize), self) #QtCore.QObject.connect(self.minimizeAction, # QtCore.SIGNAL(triggered()), self, QtCore.SLOT(hide())) #self.maximizeAction = QtGui.QAction(self.tr(Maximize), self) #QtCore.QObject.connect(self.maximizeAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showMaximized())) #self.restoreAction = QtGui.QAction(self.tr(Restore), self) #QtCore.QObject.connect(self.restoreAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showNormal())) self.quitAction = QtGui.QAction(self.tr(Quit), self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL(triggered()), QtGui.qApp, QtCore.SLOT(quit())) def createTrayIcon(self): self.trayIconMenu = QtGui.QMenu(self) #self.trayIconMenu.addAction(self.minimizeAction) #self.trayIconMenu.addAction(self.maximizeAction) #self.trayIconMenu.addAction(self.restoreAction) #self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.quitAction) self.trayIcon = QtGui.QSystemTrayIcon(self) self.trayIcon.setContextMenu(self.trayIconMenu) app = QtGui.QApplication(sys.argv) x = Systray() sys.exit(app.exec_()) How would I go about setting the icon? Sorry, here is the code with commented out lines removed: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() self.trayIcon.show() def createActions(self): self.quitAction = QtGui.QAction(self.tr(Quit), self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL(triggered()), QtGui.qApp, QtCore.SLOT(quit())) def createTrayIcon(self): self.trayIconMenu = QtGui.QMenu(self) self.trayIconMenu.addAction(self.quitAction) self.trayIcon = QtGui.QSystemTrayIcon(self) self.trayIcon.setContextMenu(self.trayIconMenu) app = QtGui.QApplication(sys.argv) x = Systray() sys.exit(app.exec_()) -- http://mail.python.org/mailman/listinfo/python-list
Re: Using QSystemTrayIcon with PyQt
On Mar 31, 8:41 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 6:40 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 11:49 am, Alex Teiche [EMAIL PROTECTED] wrote: 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_()) OK, I messed around with it some more, and it works. I just don't know how to set an icon, and the example doesn't help at all. Here is the code: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(messageClicked()), self.messageClicked) #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(activated(QSystemTrayIcon::ActivationReason)), self.iconActivated) self.trayIcon.show() def createActions(self): #self.minimizeAction = QtGui.QAction(self.tr(Minimize), self) #QtCore.QObject.connect(self.minimizeAction, # QtCore.SIGNAL(triggered()), self, QtCore.SLOT(hide())) #self.maximizeAction = QtGui.QAction(self.tr(Maximize), self) #QtCore.QObject.connect(self.maximizeAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showMaximized())) #self.restoreAction = QtGui.QAction(self.tr(Restore), self) #QtCore.QObject.connect(self.restoreAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showNormal())) self.quitAction = QtGui.QAction(self.tr(Quit), self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL(triggered()), QtGui.qApp, QtCore.SLOT(quit())) def createTrayIcon(self): self.trayIconMenu = QtGui.QMenu(self) #self.trayIconMenu.addAction(self.minimizeAction) #self.trayIconMenu.addAction(self.maximizeAction) #self.trayIconMenu.addAction(self.restoreAction) #self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.quitAction) self.trayIcon = QtGui.QSystemTrayIcon(self) self.trayIcon.setContextMenu(self.trayIconMenu) app = QtGui.QApplication(sys.argv) x = Systray() sys.exit(app.exec_()) How would I go about setting the icon? Sorry, here is the code with commented out lines removed: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() self.trayIcon.show() def createActions(self): self.quitAction = QtGui.QAction(self.tr(Quit), self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL(triggered()), QtGui.qApp, QtCore.SLOT(quit())) def createTrayIcon(self): self.trayIconMenu = QtGui.QMenu(self) self.trayIconMenu.addAction(self.quitAction) self.trayIcon = QtGui.QSystemTrayIcon(self)
Re: Using QSystemTrayIcon with PyQt
On Mar 31, 7:53 pm, Benjamin [EMAIL PROTECTED] wrote: On Mar 31, 8:41 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 6:40 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 11:49 am, Alex Teiche [EMAIL PROTECTED] wrote: 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_()) OK, I messed around with it some more, and it works. I just don't know how to set an icon, and the example doesn't help at all. Here is the code: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(messageClicked()), self.messageClicked) #QtCore.QObject.connect(self.trayIcon, QtCore.SIGNAL(activated(QSystemTrayIcon::ActivationReason)), self.iconActivated) self.trayIcon.show() def createActions(self): #self.minimizeAction = QtGui.QAction(self.tr(Minimize), self) #QtCore.QObject.connect(self.minimizeAction, # QtCore.SIGNAL(triggered()), self, QtCore.SLOT(hide())) #self.maximizeAction = QtGui.QAction(self.tr(Maximize), self) #QtCore.QObject.connect(self.maximizeAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showMaximized())) #self.restoreAction = QtGui.QAction(self.tr(Restore), self) #QtCore.QObject.connect(self.restoreAction, # QtCore.SIGNAL(triggered()), self, # QtCore.SLOT(showNormal())) self.quitAction = QtGui.QAction(self.tr(Quit), self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL(triggered()), QtGui.qApp, QtCore.SLOT(quit())) def createTrayIcon(self): self.trayIconMenu = QtGui.QMenu(self) #self.trayIconMenu.addAction(self.minimizeAction) #self.trayIconMenu.addAction(self.maximizeAction) #self.trayIconMenu.addAction(self.restoreAction) #self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.quitAction) self.trayIcon = QtGui.QSystemTrayIcon(self) self.trayIcon.setContextMenu(self.trayIconMenu) app = QtGui.QApplication(sys.argv) x = Systray() sys.exit(app.exec_()) How would I go about setting the icon? Sorry, here is the code with commented out lines removed: import sys from PyQt4 import QtCore, QtGui class Systray(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.createActions() self.createTrayIcon() self.trayIcon.show() def createActions(self): self.quitAction = QtGui.QAction(self.tr(Quit), self) QtCore.QObject.connect(self.quitAction, QtCore.SIGNAL(triggered()), QtGui.qApp, QtCore.SLOT(quit())) def createTrayIcon(self):
Re: Using QSystemTrayIcon with PyQt
On Sunday 30 March 2008, Alex Teiche 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? Thanks a ton, Alex Have you looked at PyQt's systray example? Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: Using QSystemTrayIcon with PyQt
On Mar 30, 2:08 am, Phil Thompson [EMAIL PROTECTED] wrote: On Sunday 30 March 2008, Alex Teiche 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? Thanks a ton, Alex Have you looked at PyQt's systray example? Phil No, where do I find the example? Thanks, Alex -- http://mail.python.org/mailman/listinfo/python-list
Re: Using QSystemTrayIcon with PyQt
On Sunday 30 March 2008, Alex Teiche wrote: On Mar 30, 2:08 am, Phil Thompson [EMAIL PROTECTED] wrote: On Sunday 30 March 2008, Alex Teiche 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? Thanks a ton, Alex Have you looked at PyQt's systray example? Phil No, where do I find the example? Thanks, Alex Unsurprisingly in the PyQt source package. Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: Using QSystemTrayIcon with PyQt
On Sunday 30 March 2008, Phil Thompson wrote: On Sunday 30 March 2008, Alex Teiche wrote: On Mar 30, 2:08 am, Phil Thompson [EMAIL PROTECTED] wrote: On Sunday 30 March 2008, Alex Teiche 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? Thanks a ton, Alex Have you looked at PyQt's systray example? Phil No, where do I find the example? Thanks, Alex Unsurprisingly in the PyQt source package. Phil By which I mean the current snapshot - I'd forgotten that it is a recent addition. Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: Using QSystemTrayIcon with PyQt
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 -- http://mail.python.org/mailman/listinfo/python-list
Using QSystemTrayIcon with PyQt
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? Thanks a ton, Alex -- http://mail.python.org/mailman/listinfo/python-list