[wxPython-users] Can FindReplace dialog have accelerator key?
Josiah Carlson
jcarlson at uci.edu
Sun Sep 3 11:49:04 PDT 2006
jeremy alexander <jccfifkf at yahoo.com> wrote:
>
> Hi,
>
> I'm trying to add an accelerator key to a findReplace
> dialog. The reason is that the find operation can
> take a long time and I'd like to give users a shortcut
> key to abort the find operation. Is this possible?
It is only really possible if your find/replace operation can be
cancelled. What is more likely than not is that your find/replace is
occurring in the same thread as all of your GUI handling code; and this
is likely going to be the case if you are finding/replacing inside some
text control.
What I have personally done in PyPE is to only find/replace up to 10
items at a time, then use wx.FutureCall(1, ...) to schedule another call
to handle 10 more items in 1 ms. This allows the GUI to be redrawn, etc.
Alternatively, in the find case, I have put a call to wx.Yield() in the
main loop of a 'find all' command, and checked the status of a button
that determines whether the search should stop or not.
The details of each of these are in findbar.py and findinfiles.py inside
the PyPE source distribution available from http://pype.sf.net .
- Josiah
More information about the wxpython-users
mailing list