PyQt——MDI(多文档界面)

2023-05-16

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

# -*- coding: utf-8 -*-

'''
    【简介】
	PyQt5中 QMdiArea 例子


'''

import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *


class MainWindow(QMainWindow):
    count = 0

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.mdi = QMdiArea()
        self.setCentralWidget(self.mdi)
        bar = self.menuBar()
        file = bar.addMenu("File")
        file.addAction("New")
        file.addAction("cascade")
        file.addAction("Tiled")
        file.triggered[QAction].connect(self.windowaction)
        self.setWindowTitle("MDI demo")

    def windowaction(self, q):
        print("triggered")

        if q.text() == "New":
            MainWindow.count = MainWindow.count + 1
            sub = QMdiSubWindow()
            sub.setWidget(QTextEdit())
            sub.setWindowTitle("subwindow" + str(MainWindow.count))
            self.mdi.addSubWindow(sub)
            sub.show()
        if q.text() == "cascade":
            self.mdi.cascadeSubWindows()
        if q.text() == "Tiled":
            self.mdi.tileSubWindows()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    demo = MainWindow()
    demo.show()
    sys.exit(app.exec_())


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

PyQt——MDI(多文档界面) 的相关文章

  • 如何从AD导出PDF原理图

    https jingyan baidu com article 7c6fb428d4759080642c9017 html
  • PyQt ——setStyleSheet用法

    这个是CSS的手册 xff0c 所有的东西都可以参考这里 xff1a https css doyoe com 下面是CSS 的东西 字体属性 xff1a font 大小 font size x large 特大 xx small 极小 一般
  • QMessageBox

    span class token triple quoted string string 39 39 39 简介 PyQt5中 QMessage 例子 39 39 39 span span class token keyword impor
  • QInputDialog

    span class token triple quoted string string 39 39 39 简介 PyQt5中 QInputDialog 例子 39 39 39 span span class token keyword i
  • python cherry 用法

    CheeryPy是一个 Pythonic 的 面向对象的 Web 框架 xff0c 能够用于接受POST或者GET请求并进行回复 CheeryPy中文文档 xff1a Cherrypy 一个极简的python web框架 CherryPy
  • PyQt——简单进度条程序

    span class token keyword from span PyQt5 span class token punctuation span QtCore span class token keyword import span Q
  • PyQt——窗口居中

    span class token comment coding utf 8 span span class token keyword import span sys span class token keyword from span P
  • PyQt——分离UI主线程与工作线程

    span class token comment coding utf 8 span span class token keyword import span sys span class token keyword from span P
  • PyQt——信号与槽简介

    信号与槽简介 定义信号 操作信号
  • PyQt——信号与槽基础应用

    信号与槽有三种使用方法 xff0c 第一种是内置信号与槽的使用 xff0c 第二种是自定义信 号与槽的使用 xff0c 第三是装饰器的信号与槽的使用 由于第三种方法本质上是第一 种方法的衍生 内置信号与槽的使用 所谓内置信号与槽的使用 xf
  • PyQt——信号与槽函数快速进阶

    内置信号与槽函数 span class token keyword from span PyQt5 span class token punctuation span QtWidgets span class token keyword i
  • PyQt——自定义信号与槽的高级应用

    高级自定义信号与槽 span class token keyword from span PyQt5 span class token punctuation span QtCore span class token keyword imp
  • PyQt——键盘事件和鼠标事件

    PyQt为事件处理提供了两种机制 xff1a 高级的信号和槽机制 xff0c 以及低级的事件处理程序 PyQt为拦截和处理事件提供了5种不同的方式 xff0c 这里只介绍最常用的头两种方式 第一种是重新实现特定事件 xff0c 如键盘和鼠标
  • PyQt——按钮类控件QAbstractButton

    按钮类控件 QPushButton
  • PyQt——按钮类控件QPushButton

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtCo
  • spss入门基本用法

    一 xff0e 数据 1 个案排序 xff1a 对数据视图中的某个个案进行排序 xff0c 具体排序规则可以点进去选择 2 变量排序 xff1a 对变量视图中某个变量进行排序 xff0c 具体规则可以点进去选择 3 转置 xff1a 行列互
  • 基于OMAPL138的linux平台8250快速串口实现--UART+EDMA

    本文源码基于dvsdk omapl138 evm 04 03 00 06 setuplinux程序包里的linux3 3 0版本的内核 实现EDMA支持UART功能主要修改dma和8250的源码 首先为OMAPL138的arm和DSP分配d
  • 自定义组件——仪表盘

    span class token keyword from span PyQt5 span class token punctuation span QtCore span class token keyword import span s
  • 基于pyqt5的Demo软件开发

    一 功能 从软件界面上打开一个txt文件 xff0c 后台提取内容 xff0c 显示在界面上 通过这个Demo软件 xff0c 可以练习软件开发的基本流程 不进行异常的设计 xff0c 仅设计按照正常流程走的程序 二 环境 OS xff1a
  • 使用Graphviz和Pyreverse绘制Python项目结构图

    简介 Graphviz开源的图形绘制工具包 Pyreverse分析Python代码和类关系的工具 安装 安装Graphviz 官网下载地址 注意添加bin 目录的路径到系统路径 测试是否安装成功 dot help 安装Pyreverse 现

随机推荐

  • python获取当前时间的用法

    1 先导入库 xff1a import datetime 2 获取当前日期和时间 xff1a now time 61 datetime datetime now 3 格式化成我们想要的日期 xff1a strftime xff08 xff0
  • PyQt——用Matplotlib绘制动态曲线、柱形、二维、三维图

    span class token comment coding utf 8 span span class token keyword from span PyQt5 span class token keyword import span
  • PyQt——QRadioButton

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtCo
  • PyQt——QCheckBox

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtCo
  • PyQt——QComboBox

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtCo
  • 目录

    PyQt 目录 第四章 xff1a PyQt5 基本窗口控件 4 5 按钮类控件 QAbastractButtonQPushButtonQRadioButtonQCheckBox 4 6 下拉列表框 QComboBox 4 7 计数器 QS
  • PyQt中常见问题解决

    1 ModuleNotFoundError No module named PyQt5 QtChart sudo apt get install reinstall python3 pyqt5 pip3 install upgrade fo
  • lingo入门教程之一 --- 初识lingo

    lingo对于一些线性或者非线性的规划 xff0c 优化问题非常有效 首先介绍一下 xff0c 在lingo中运行程序时出现的页面 xff08 在工具栏点击类似靶子一样的图标便可运行 xff09 Solver status 求解器 求解程序
  • PyQt——QSpinBox(计数器)

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtCo
  • PyQt——QSlider(滑动条)

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtCo
  • PyQt——QTableView

    span class token keyword from span PyQt5 span class token punctuation span QtWidgets span class token keyword import spa
  • 正则表达式——验证数字

    验证数字 xff1a span class token operator span span class token punctuation span span class token number 0 span span class to
  • PyQt——QTableWidget

    span class token keyword import span sys span class token keyword from span PyQt5 span class token punctuation span QtWi
  • PyQt——QListView

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QListView 例子
  • PyQt——QListWidget

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QListWidget 例
  • PyQt——QTabWidget

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QTabWidget 例子
  • PyQt——QStackedWidget

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QStackedWidge
  • PyQt——QDockWidget

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QDockWidget 例
  • lingo入门教程之二 --- 集合运用

    lingo中的集合用法很多 xff0c 这里主要通过几个例题来进行讲解 对于每一个问题 xff0c 都要先找到对应的目标函数 xff0c 然后对相应值进行初始化 xff0c 然后找到约束条件等进行求解 例1 xff1a SAILCO公司需要
  • PyQt——MDI(多文档界面)

    span class token comment coding utf 8 span span class token triple quoted string string 39 39 39 简介 PyQt5中 QMdiArea 例子 3