python: Multi Document Interface (MDI) using PyQt6
# encoding: utf-8
# 版权所有 2024 涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:pip install pyqt6
# Author : geovindu,Geovin Du 涂聚文.
# IDE : PyCharm 2023.1 python 3.11
# os : windows 10
# database : mysql 9.0 sql server 2019, poostgreSQL 17.0
# Datetime : 2024/12/7 23:37
# User : geovindu
# Product : PyCharm
# Project : Pysimple
# File : qt6mdi.py
# explain : 学习
import sys
from PyQt6.QtWidgets import QApplication, QMainWindow, QMdiArea, QMdiSubWindow, QMenu # , QAction
class MdiWindow(QMainWindow):
"""
"""
def __init__(self):
super().__init__()
self.mdiArea = QMdiArea()
self.setCentralWidget(self.mdiArea)
self.createMenus()
def createMenus(self):
"""
:return:
"""
menubar = self.menuBar()
# File Menu
fileMenu = menubar.addMenu("File")
newAction = fileMenu.addAction("New")
newAction.triggered.connect(self.createNewSubWindow)
# Window Menu
windowMenu = menubar.addMenu("Window")
windowMenu.addAction("Tile", self.mdiArea.tileSubWindows)
windowMenu.addAction("Cascade", self.mdiArea.cascadeSubWindows)
def createNewSubWindow(self):
"""
:return:
"""
subWindow = QMdiSubWindow()
subWindow.setWindowTitle("New Subwindow")
subWindow.resize(300,300)
self.mdiArea.addSubWindow(subWindow)
subWindow.show()
if __name__ == "__main__":
"""
"""
app = QApplication(sys.argv)
window = MdiWindow()
window.show()
sys.exit(app.exec())
哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)生存.---Geovin Du(涂聚文)
浙公网安备 33010602011771号