Discussion:
[Tkinter-discuss] How do Tkinter's Entry/Text support for Ctrl+X/Ctrl+C/Ctrl+V (cut, copy, paste) work in non-English locales?
python
2010-12-10 15:13:28 UTC
Permalink
It seems that Tkinter Entry and Text widgets have built in
support for basic clipboard functionality via the keystrokes
Ctrl+X/Ctrl+C/Ctrl+V (cut, copy, paste).

Of course these make sense for English speaking locales. How does
this functionality work when Tkinter is used in non-English
locales? Are these keystroke shortcuts hard coded or do they
switch to locale/language specific shortcuts?

Is there a way to turnoff this functionality or map these
built-in clipboard keystrokes to different keys?

Thanks,
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20101210/b55afca0/attachment.html>
Michael Lange
2010-12-10 17:46:30 UTC
Permalink
Hi,

Thus spoketh python at bdurham.com
Post by python
It seems that Tkinter Entry and Text widgets have built in
support for basic clipboard functionality via the keystrokes
Ctrl+X/Ctrl+C/Ctrl+V (cut, copy, paste).
Of course these make sense for English speaking locales. How does
this functionality work when Tkinter is used in non-English
locales? Are these keystroke shortcuts hard coded or do they
switch to locale/language specific shortcuts?
These bindings are hard-wired in the tk.tcl file, depending on the
platform (X11, windows, mac).
Post by python
Is there a way to turnoff this functionality or map these
built-in clipboard keystrokes to different keys?
This is in fact quite straightforward.
For example if you want to change the default binding for a paste
Post by python
e1=Entry()
e1.pack()
e1.event_delete('<<Paste>>', '<Control-v>')
e1.event_add('<<Paste>>', '<Control-q>')
I'm not sure if this would make sense, though. Aren't these default
bindings the same for any locale (at least this is true for germany :)?

Regards

Michael

.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.

There are certain things men must do to remain men.
-- Kirk, "The Ultimate Computer", stardate 4929.4
python
2010-12-10 17:55:03 UTC
Permalink
Michael,
e1.event_delete('<<Paste>>', '<Control-v>')
e1.event_add('<<Paste>>', '<Control-q>')
Thank you! That's the *exact* technique I was searching for.
I'm not sure if this would make sense, though. Aren't these default bindings the same for any locale (at least this is true for germany :)?
I mistakenly thought that these bindings were localized for each
language. Thanks for correcting me.

Malcolm

Loading...