Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yjg30737/pyqt-find-text-widget
PyQt widget which can be used to find text in QTextEdit/QTextBrowser
https://github.com/yjg30737/pyqt-find-text-widget
pyqt5 pyqt5-examples pyqt5-find-text pyqt5-tutorial python python3 python37 qt qt-examples qt-gui qt-tutorial qt5 qt5-gui
Last synced: about 2 months ago
JSON representation
PyQt widget which can be used to find text in QTextEdit/QTextBrowser
- Host: GitHub
- URL: https://github.com/yjg30737/pyqt-find-text-widget
- Owner: yjg30737
- License: mit
- Created: 2021-11-29T09:59:07.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-09T09:25:05.000Z (over 2 years ago)
- Last Synced: 2024-04-26T09:45:51.772Z (10 months ago)
- Topics: pyqt5, pyqt5-examples, pyqt5-find-text, pyqt5-tutorial, python, python3, python37, qt, qt-examples, qt-gui, qt-tutorial, qt5, qt5-gui
- Language: Python
- Homepage:
- Size: 32.8 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
* pyqt-svg-button## Feature
* Find previous, next occurence based on text cursor's position
* prev shortcut: Ctrl+Shift+D
* next shortcut: Ctrl+D
* 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
```python
from PyQt5.QtWidgets import QMainWindow, QApplication, QGridLayout, QWidget, QTextEdit
from pyqt_find_text_widget.findTextWidget import FindTextWidgetclass 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 sysapp = 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.
https://user-images.githubusercontent.com/55078043/147844492-53b355ff-801a-4fca-bbef-c37fb55d1418.mp4
Match case & complete word only example
https://user-images.githubusercontent.com/55078043/147844473-76474b51-2b2d-4680-82e4-8a67ab263db3.mp4