PyQt5+python3的FindDialog
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt, pyqtSignal class FindDialog(QDialog):
findNext = pyqtSignal(str, Qt.CaseSensitivity)
findPrevious = pyqtSignal(str, Qt.CaseSensitivity) def __init__(self, parent = None):
super().__init__(parent)
self.label = QLabel(self.tr("Find &what:"))
self.lineEdit = QLineEdit()
self.label.setBuddy(self.lineEdit) self.caseCheckBox = QCheckBox(self.tr("Match &case"))
self.backwardCheckBox = QCheckBox(self.tr("Search &backward")) self.findButton = QPushButton(self.tr("&Find"))
self.findButton.setDefault(True)
self.findButton.setEnabled(False) self.closeButton = QPushButton(self.tr("Close"))
self.lineEdit.textChanged.connect(self.enableFindButton)
self.findButton.clicked.connect(self.findClicked)
self.closeButton.clicked.connect(self.close) self.topLeftLayout = QHBoxLayout()
self.topLeftLayout.addWidget(self.label)
self.topLeftLayout.addWidget(self.lineEdit) self.leftLayout = QVBoxLayout()
self.leftLayout.addLayout(self.topLeftLayout)
self.leftLayout.addWidget(self.caseCheckBox)
self.leftLayout.addWidget(self.backwardCheckBox) self.rightLayout = QVBoxLayout()
self.rightLayout.addWidget(self.findButton)
self.rightLayout.addWidget(self.closeButton)
self.rightLayout.addStretch() self.mainLayout = QHBoxLayout()
self.mainLayout.addLayout(self.leftLayout)
self.mainLayout.addLayout(self.rightLayout)
self.setLayout(self.mainLayout)
self.setWindowTitle(self.tr("Find"))
self.setFixedHeight(self.sizeHint().height()) def findClicked(self):
text = self.lineEdit.text()
cs = (Qt.CaseSensitive if self.caseCheckBox.isChecked()
else Qt.CaseInsensitive) if self.backwardCheckBox.isChecked():
self.findPrevious.emit(text, cs)
else:
self.findNext.emit(text, cs) def enableFindButton(self, text):
self.findButton.setEnabled(not text == '') if __name__ == '__main__':
app = QApplication(sys.argv)
dialog = FindDialog()
dialog.show()
sys.exit(app.exec())
PyQt5+python3的FindDialog的更多相关文章
- PyQt5+Python3.5.2-32bit开发环境搭建
1.基本环境. Window 8.1 64bit Python3.5.2-32bit.exe PyQt5 2.安装python. 去官网下载32位版本的python3.5.2(就是x86那个) 备 ...
- PyCharm 2017.2.2+PyQt5+Python3.6.0
PyCharm注册地址 http://idea.imsxm.com/ 安装的是miniconda激活虚拟环境执行pip install PyQt5pip install PyQt5-tools 从官网 ...
- Ubuntu+PyQt5+Python3.6+Qt Designer 实现可视化窗口的编辑
一.为什么写这片博文 近期将实验室的电脑的OS换成了ubuntu,想对linux进一步的了解和使用.在使用的过程中想用python+pyqt5写一个音乐播放器和视频播放器(这也是linux的乐趣所在) ...
- PyQt5+python3+pycharm开发环境配置
1.下载PyQt https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.6/PyQt5-5.6-gpl-Py3.5-Qt5.6.0-x32- ...
- 程序员之路:python3+PyQt5+pycharm桌面GUI开发
http://blog.sina.com.cn/s/blog_989218ad0102wz1k.html 先看效果: 图 1 没错,学过C#的同学应该很熟悉这个界面,按钮风格和界面风格很相似,万万没想 ...
- 程序员之路:python3+PyQt5+pycharm桌面GUI开发(转)
程序员之路:python3+PyQt5+pycharm桌面GUI开发 http://blog.sina.com.cn/s/blog_989218ad0102wz1k.html 先看效果: 图 1 没错 ...
- Python3 安装 PyQt5 -pycharm 环境搭建
执行命令: pip3 install PyQt5 PyQt5+python3+pycharm开发环境配置 1.下载PyQt 官方网站:http://www.riverbankcomputing.c ...
- python3+pyQt5+QtDesignner实现窗口化猜数字游戏
描述:使用QtDesignner设计界面,pyQt5+python3实现主体方法制作的猜数字游戏. 游戏规则:先选择游戏等级:初级.中级.高级.魔鬼级,选择完游戏等级后点击“确定”,然后后台会自动生成 ...
- pycharm+PyQt5+python最新开发环境配置,踩坑过程详解
安装工具:Pycharm 专业版2017.3PyQT5python3 pyqt5-tools 设置扩展工具的参数找到setting->tools->external tools,点击加号新 ...
随机推荐
- Rectangle 响应按键
import QtQuick 2.4 import QtQuick.Window 2.2 Window { visible: true MainForm { anchors.fill: parent ...
- 使用Thumbnails对一个文件夹下的所有图片进行压缩处理
public static void compressPic(){ try { Thumbnails.of(new File("/home/y/my_temp/ydbg-xy-pic&quo ...
- HBase HTablePool
Instead of creating an HTable instance for every request from your client application, it makes much ...
- 【模拟】HDU 5774 Where Amazing Happens
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5774 题目大意: 已知1946~2015每一年赢得人是谁,给n个名字,问赢了多少次. 题目思路: [ ...
- 网页a标签:导航制作 怎么让鼠标经过A标签的时候显示块状背景?
文章出处:http://dongguan.seosrx.net/website/6.html
- House Robber——LeetCode
You are a professional robber planning to rob houses along a street. Each house has a certain amount ...
- RMQ——[USACO Jan07] 均衡队形题解
题目:[USACO Jan07] 均衡队形 描述: 题目描述 农夫约翰的 N (1 ≤ N ≤ 50,000) 头奶牛,每天挤奶时总会按同样的顺序站好.一日,农夫约翰决定为奶牛们举行一个“终极飞盘”比 ...
- oracle连接进程数设置
SQL> select count(*) from v$session #连接数SQL> Select count(*) from v$session where status='ACTI ...
- 寻找INTERIGHT衬衫男神! [复制链接]
寻找INTERIGHT衬衫男神! - 公告板 - 京东内部论坛 - Powered by Discuz! 寻找INTERIGHT衬衫男神! [复制链接]
- MARCHdesign_王濤's 星云个人网站 | www.xingyun.cn/MARCHdesign
MARCHdesign_王濤's 星云个人网站 | www.xingyun.cn/MARCHdesign MARCHdesign_王濤