PyQt5 创建主窗口
#! /usr/bin/env python
# -*- coding:utf-8 -*-
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication
from PyQt5.QtGui import QIcon
class M_Window(QMainWindow):
def __init__(self):
super().__init__()
self.resize(600,350)
self.status = self.statusBar()
# 状态栏可以设置显示时间,如果没有设置时间参数,状态栏将一直显示
self.status.showMessage("状态栏:创建主窗口")
self.setWindowTitle("创建主窗口")
self.setWindowIcon(QIcon("./icon/title.png"))
if __name__ == "__main__":
app = QApplication(sys.argv)
m_form = M_Window()
m_form.show()
sys.exit(app.exec_())