'how to equate key.chars with its name
I created a Text widget from Tkinter and when a user types something I want to collect it is as a word for example if the user press backspace the last letter should be removed or if it other letters, it should be printed. However, when I try to equalize keys. chars with its own name I return nothing
self.text.bind('<Key>', self.callback)
def callback(self, event):
key = '{k!r}'.format(k=event.char)
if key == '\x08' : # backspace
self.keys = self.keys[:-1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
