code like the following .After it running for about half a minute ,then close the window, then the "Python has stopped working" dialog pops up(you had better try more than once. ) I wonder why this happen ?any solution to this ? Tested on Windows with PyQt4-4.11.3-gpl-Py3.4-Qt4.8.6-x32.exe
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowIcon(QIcon("./wa.png"))
self.createTrayIcon()
def createTrayIcon(self):
self.trayIcon = QSystemTrayIcon()
self.trayIcon.setIcon(self.windowIcon())
self.trayIcon.show()
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
ui = MainWindow()
ui.show()
sys.exit(app.exec_())
super()
call with no argument looked wrong, and indeed when I try to run the code it complains that it requires at least one argument. – Iosif Spulber