Skip to content Skip to sidebar Skip to footer

Pyqt System Tray Icon Exit When Click Menu Item

I am new to python and pyqt, I learn them today and write a small system tray demon, it run , but when i click 'about', and then close the dialog, the app exit. I don't know why S

Solution 1:

You can set the application quitOnLastWindowClosed property to False:

def main():
    app = QtGui.QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(False)
    trayIcon = SystemTrayIcon(QtGui.QIcon("trash.svg"))
    trayIcon.show()
    sys.exit(app.exec_())

Post a Comment for "Pyqt System Tray Icon Exit When Click Menu Item"