#http://blog.csdn.net/weiaitaowang/article/details/52067647
import sys
from PyQt5.QtWidgets import QApplication , QWidget
from PyQt5.QtGui import QIcon
class MyIcon (QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setGeometry(100, 100, 300, 500)
self.setWindowTitle('My icon app')
self.setWindowIcon(QIcon('F:\python\source\2.png'))
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
myicon = MyIcon()
sys.exit(app.exec_())