PyQt widget which can be used to find text in QTextEdit/QTextBrowser
Project description
pyqt-find-text-widget
PyQt widget which can be used to find text in QTextEdit/QTextBrowser
Requirements
PyQt5 >= 5.8
Setup
python -m pip install pyqt-find-text-widget
Included Packages
Feature
-
Find previous, next occurence based on text cursor's position
-
Match case
-
Makes find match only complete words
-
Providing prev, next, close signals
-
Enable to set close button with
setCloseBtn(f: bool)
I'm still working with regex feature.
Signal
-
prevClicked
-
nextClicked
-
closeSignal
Usage
Code Sample
from PyQt5.QtWidgets import QMainWindow, QApplication, QGridLayout, QWidget, QTextEdit
from pyqt_find_text_widget.findTextWidget import FindTextWidget
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
self.__te = QTextEdit()
self.__te.setStyleSheet('QTextEdit { selection-background-color: lightblue; }') # I wrote this code because color of default selection doesn't stand out in the white textedit screen.
self.__w = FindTextWidget(self.__te)
lay = QGridLayout()
lay.addWidget(self.__w)
lay.addWidget(self.__te)
mainWidget = QWidget()
mainWidget.setLayout(lay)
self.setCentralWidget(mainWidget)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
mainWindow = MainWindow()
mainWindow.show()
sys.exit(app.exec_())
Result
Note: Button icons in preview are obsolete. Back then these icons were PNG, now these are SVG! So don't worry about the difference.
Match case & complete word only example
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pyqt-find-text-widget-0.0.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d7b67f4c2ffca0feaf5b55ccf2aed4d93105533c1dabc1f881b376461a029d6 |
|
MD5 | 5e9ac4c3f8887a1983802b66630da151 |
|
BLAKE2b-256 | 0ff4b777180c85c2b84ce0d178e5ab9617f79594e9120bb80da43baa65300466 |
Hashes for pyqt_find_text_widget-0.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2549686befdd2cbf873593f4cc12bcd5877aa4cdf444b965290e575e6684f943 |
|
MD5 | c2d33ec65065519841c134705f9ec444 |
|
BLAKE2b-256 | a11239ce3a2f6c8e44f392be228679fe8108cf7f165214aeb6a145e952363794 |