Hello,
To let users search text, I currently simply 1) launch Windows’ Notepad and 2) paste text, and the user uses its embedded Find dialog.
Does wxPython provide a text control with search feature instead?
This solution requires more modules.
Thank you.
The StyledTextCtrl provides several methods for finding text, see: wx.stc.StyledTextCtrl — wxPython Phoenix 4.2.3 documentation
Some time ago I did some experiments just using the FindText()
method. Here is a simple version:
stc_find_text.py (6.2 KB)
That example loads the contents of its own source file and sets it as read-only.
There are toggle buttons for the regular expressions, case sensitive and whole words search options.
It seems to work OK (although I’m not sure about the format for regex search patterns).
Tested using wxPython 4.2.3 gtk3 (phoenix) wxWidgets 3.2.7 + Python 3.12.3 + Linux Mint 22.1
1 Like
You can find something similar in the “wxpython demo”.
1 Like