PyQt---Create the main window

QMainWindow: menu bar, toolbar, status bar, the most common;
QDialog: the base class of dialog window;
QWidget: the purpose of the uncertain window is to use QWidget;

import sys
from PyQt5.QtWidgets import QMainWindow, QApplication


class FirstMainWin(QMainWindow):
    def __init__(self):           #self代表实例本身
        super(FirstMainWin, self).__init__()      #调用父类初始化方法

        #设置主窗口的标题
        self.setWindowTitle("第一个窗口应用")

        #设置窗口的尺寸
        self.resize(400,300)

        #默认获取状态栏
        self.status=self.statusBar()

        self.status.showMessage("只存在5秒的消息",5000)    #5000ms

if __name__=='__main__':
        app=QApplication(sys.argv)

        main=FirstMainWin()
        main.show()

        sys.exit(app.exec_())

Guess you like

Origin blog.csdn.net/Forest_2Cat/article/details/105632216