没有合适的资源?快使用搜索试试~ 我知道了~
首页python3+PyQt5+Qt Designer实现扩展对话框
资源详情
资源评论
资源推荐
python3+PyQt5+Qt Designer实现扩展对话框实现扩展对话框
主要为大家详细介绍了python3+PyQt5+Qt Designer实现扩展对话框,具有一定的参考价值,感兴趣的小伙伴们
可以参考一下
本文是对《Python Qt GUI快速编程》的第9章的扩展对话框例子Find and replace用Python3+PyQt5+Qt Designer进行改写。
第一部分无借用Qt Designer,完全用代码实现。
第二部分则借用Qt Designer,快速实现。
第一部分:第一部分:
import sys
from PyQt5.QtCore import Qt,pyqtSignal
from PyQt5.QtWidgets import (QApplication, QCheckBox, QDialog, QFrame,
QGridLayout, QHBoxLayout, QLabel, QLayout, QLineEdit,
QPushButton, QVBoxLayout)
class FindAndReplaceDlg(QDialog):
find = pyqtSignal(str,bool,bool,bool,bool,bool)
replace = pyqtSignal(str,str,bool,bool,bool,bool,bool)
def __init__(self, parent=None):
super(FindAndReplaceDlg, self).__init__(parent)
findLabel = QLabel("Find &what:")
self.findLineEdit = QLineEdit()
findLabel.setBuddy(self.findLineEdit)
replaceLabel = QLabel("Replace w&ith:")
self.replaceLineEdit = QLineEdit()
replaceLabel.setBuddy(self.replaceLineEdit)
self.caseCheckBox = QCheckBox("&Case sensitive")
self.wholeCheckBox = QCheckBox("Wh&ole words")
self.wholeCheckBox.setChecked(True)
self.moreFrame = QFrame()
self.moreFrame.setFrameStyle(QFrame.StyledPanel|QFrame.Sunken)
self.backwardsCheckBox = QCheckBox("Search &Backwards")
self.regexCheckBox = QCheckBox("Regular E&xpression")
self.ignoreNotesCheckBox = QCheckBox("Ignore foot¬es "
"and endnotes")
line = QFrame()
line.setFrameStyle(QFrame.VLine|QFrame.Sunken)
self.findButton = QPushButton("&Find")
self.replaceButton = QPushButton("&Replace")
closeButton = QPushButton("Close")
self.moreButton = QPushButton("&More")
self.moreButton.setCheckable(True)
gridLayout = QGridLayout()
gridLayout.addWidget(findLabel, 0, 0)
gridLayout.addWidget(self.findLineEdit, 0, 1)
gridLayout.addWidget(replaceLabel, 1, 0)
gridLayout.addWidget(self.replaceLineEdit, 1, 1)
frameLayout = QVBoxLayout()
frameLayout.addWidget(self.backwardsCheckBox)
frameLayout.addWidget(self.regexCheckBox)
frameLayout.addWidget(self.ignoreNotesCheckBox)
self.moreFrame.setLayout(frameLayout)
leftLayout = QVBoxLayout()
leftLayout.addLayout(gridLayout)
leftLayout.addWidget(self.caseCheckBox)
leftLayout.addWidget(self.wholeCheckBox)
leftLayout.addWidget(self.moreFrame)
buttonLayout = QVBoxLayout()
buttonLayout.addWidget(self.findButton)
buttonLayout.addWidget(self.replaceButton)
buttonLayout.addWidget(closeButton)
buttonLayout.addWidget(self.moreButton)
buttonLayout.addStretch()
mainLayout = QHBoxLayout()
mainLayout.addLayout(leftLayout)
mainLayout.addWidget(line)
mainLayout.addLayout(buttonLayout)
self.setLayout(mainLayout)
weixin_38690095
- 粉丝: 4
- 资源: 914
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 27页智慧街道信息化建设综合解决方案.pptx
- 计算机二级Ms-Office选择题汇总.doc
- 单链表的插入和删除实验报告 (2).docx
- 单链表的插入和删除实验报告.pdf
- 物联网智能终端项目设备管理方案.pdf
- 如何打造品牌的模式.doc
- 样式控制与页面布局.pdf
- 武汉理工Java实验报告(二).docx
- 2021线上新品消费趋势报告.pdf
- 第3章 Matlab中的矩阵及其运算.docx
- 基于Web的人力资源管理系统的必要性和可行性.doc
- 基于一阶倒立摆的matlab仿真实验.doc
- 速运公司物流管理模式研究教材
- 大数据与管理.pptx
- 单片机课程设计之步进电机.doc
- 大数据与数据挖掘.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0