[Tkinter-discuss] How do Tkinter's Entry/Text support for Ctrl+X/Ctrl+C/Ctrl+V (cut, copy, paste) work in non-English locales?

Michael Lange klappnase at web.de
Fri Dec 10 18:46:30 CET 2010


Thus spoketh python at bdurham.com 
unto us on Fri, 10 Dec 2010 10:13:28 -0500:

> 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). 

> 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
event from Ctrl-v into Ctrl-q , you can do:

>>> 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 :)? 



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

There are certain things men must do to remain men.
		-- Kirk, "The Ultimate Computer", stardate 4929.4

More information about the Tkinter-discuss mailing list