Tkinter: text widget predefined key bindings

Michele Simionato mis6 at
Tue Aug 27 15:02:40 CEST 2002

- I discovered by trials that the text widget recognizes some 
predefined key bindings; for instance C-k delete a line, C-o insert 
a newline,C-e goes at the end of a line, C-t transpose two chars, C-i 
insert a tab, etc. etc. These settings sometimes are useful, sometimes 
are annoying. Suppose for instance I want to rebind, C-k:

text.bind('<Control-k>',lambda event : dosomething())

it works, in the sense that  dosomething() is executed, but 
unfortunately the line is killed too ! 

text.unbind('<Control-k>') doesn't work.

How can I get rid of these hard coded bindings ?

- Second question: is there some predefined binding for undo ? 
C-z and C-u do not work. If there is no undo, how could I implement 
some simple undo routine ?


Michele Simionato - Dept. of Physics and Astronomy
210 Allen Hall Pittsburgh PA 15260 U.S.A.
Phone: 001-412-624-9041 Fax: 001-412-624-9163

More information about the Python-list mailing list