On Wed, 30 Jan 2008 13:32:00 +0100, Helmut Jarausch  
<[EMAIL PROTECTED]> wrote:
[snip]
> 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.

You can get the position of the insertion point with  
entry.index('insert'), and set it via entry.icursor(index). If you want to  
do this as the user types, take care to bind to KeyRelease; this way, the  
character corresponding to the key has already been entered in the entry.

BTW, you may also want to automatically select the part that the user  
hasn't actually typed. This can be done with entry.selection_clear(), then  
entry.selection_range(start_position, end_position).

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to