从PyQt5最基础的内容开始学习
import sys
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget, QApplication, QTextBrowser
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.resize(300, 300)
self.setWindowTitle('HeadIcon')
self.setWindowIcon(QIcon('icon.jpg'))
self.text_browser = QTextBrowser(self)
self.text_browser.resize(300, 300)
self.text_browser.setText("Hello World again!")
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
运行结果: