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,点击加号新 ...
随机推荐
- STM8S学习笔记-时钟控制1
1.图13可见,STM8S单片机主要有四种时钟源可供选择: 1).1-24MHz外部晶体振荡器(HSE). 2).最大24MHz外部时钟(HSE ext). 3).16MHz高速内部RC振荡器(HSI ...
- POJ 2391 容牛问题
题目大意:给定一个无向图,点i处有Ai头牛,点i处的牛棚能容纳Bi头牛,求一个最短时间T使得在T时间内所有的牛都能进到某一牛棚里去.(1 <= N <= 200, 1 <= M &l ...
- Number of 1 Bits——LeetCode
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also know ...
- chrome性能测试框架webpagereplay
今天学习了下chrome的性能测试框架,其实它可用于在稳定的环境下测试浏览器向服务器发起http请求至下载请求文档到本地的这个过程.好处在于,其原理在于先将第一次请求回来的文档下载在本地,然后在本地模 ...
- C++中的位域(bit-filed):一种节省空间的成员
转载自:http://www.cppblog.com/suiaiguo/archive/2009/07/16/90211.html 有一种被称为位域(bit-field) 的特殊的类数据成员,它可以被 ...
- linux下安装mysql-community后起不来
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpmrpm -ivh http://repo.mysql.com/my ...
- APP开发者到期续费说明
几步搞明白APP开发者续费,不再苦恼.1.APP开发者账号快满一年时,注册邮箱会收到一封提醒续费的邮件.主题类似5 days left to renew your iOS Developer Prog ...
- ListView的优化
1. ListView须要设置adapter,它的item是通过adapter的方法getView(int position, View convertView, ViewGroup parent)获 ...
- [Falcor] Retrieving Multiple Values
In addition to being able to retrieve a path from a Falcor Model, you can also retrieve multiple Pat ...
- MSSQL row_number简单使用语法
MSSQL row_number简单使用语法 select * from ( select row_number() over(partition by threadid order by date ...