Reputation: 8939
How can I bind the + and - keys to commands in Tcl/Tk?
Upvotes: 4
Views: 1593
Reputation: 170
For this particular problem:
set foo "t:"
pack [label .l -textvar foo]
bind . <Key-plus> {append foo "+"}
bind . <Key-KP_Add> {append foo "(+)"}
bind . <Key-minus> {append foo "-"}
bind . <Key-KP_Subtract> {append foo "(-)"}
But in general you can find the key name by running "xev" and pressing that key.
Upvotes: 6