H
Helmut Jarausch
Hi,
I don't want to reinvent the wheel but I cannot find it so far.
Many editors have a so-called incremental search feature.
As you type characters, elements of a set of strings which fit so far are
displayed or at least, the first one of these is displayed.
Now I want to do something similar in Tkinter - an Entry widget
which displays possible 'completions'
e.g. given the list of names (...,'Hardy','Helmut',..)
As soon as enter the character 'H' the string 'Hardy'
would be displayed in the Entry widget - but the cursor
is still at position 2 (given 'H' is a position 1)
Furthermore, as soon as I enter 'e', it would change the
text to 'Helmut', and so on.
While I can bind '<Key>' to a callback, I haven't figured out how
to get (and later on set) the cursor within the Entry widget.
In other words I need to know at which character position the last
character was entered.
Currently I can only see the brute force method: keeping track of
all cursor positioning means like <Backspace>, <Del>, the '<-' and '->' keys
and mouse clicks.
Is there an easier method?
Many thanks for a hint or even a pointer to an example,
Helmut.
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
I don't want to reinvent the wheel but I cannot find it so far.
Many editors have a so-called incremental search feature.
As you type characters, elements of a set of strings which fit so far are
displayed or at least, the first one of these is displayed.
Now I want to do something similar in Tkinter - an Entry widget
which displays possible 'completions'
e.g. given the list of names (...,'Hardy','Helmut',..)
As soon as enter the character 'H' the string 'Hardy'
would be displayed in the Entry widget - but the cursor
is still at position 2 (given 'H' is a position 1)
Furthermore, as soon as I enter 'e', it would change the
text to 'Helmut', and so on.
While I can bind '<Key>' to a callback, I haven't figured out how
to get (and later on set) the cursor within the Entry widget.
In other words I need to know at which character position the last
character was entered.
Currently I can only see the brute force method: keeping track of
all cursor positioning means like <Backspace>, <Del>, the '<-' and '->' keys
and mouse clicks.
Is there an easier method?
Many thanks for a hint or even a pointer to an example,
Helmut.
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany