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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57aa3dd757e899e2ef2304e6c9fa1b06b8ea260d34878062fab66e8d67dfdf8a |
|
MD5 | b8f27361c7c6831e993db474d5a88eff |
|
BLAKE2b-256 | 2ca4c5ee2276a529847d644fc2bc2893982e837ddb3dfe641925365b171bea0f |
Hashes for pyqt_find_text_widget-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20018f24b1cdfe88c532cf6f5cf38de209c6901363a9840e763b64b5020c0f35 |
|
MD5 | b375d10bad136986be4d7b55c5c0eb1d |
|
BLAKE2b-256 | 375bc3e2d25cf0a2ec50816ce1f162e0f20cba8796141de726ee34b4429d0e80 |