text-widget

Tkinter: set StringVar after <Key> event, including the key pressed

两盒软妹~` 提交于 2019-11-26 17:48:50
问题 Every time a character is entered into a Text widget, I want to get the contents of that widget and subtract its length from a certain number (basically a "you have x characters left" deal). But the StringVar() is always one event behind. This is, from what I gather, because the event is processed before the character is entered into the Text widget. This means that if I have 3 characters in the field and I enter a 4th, the StringVar is updated but is still 3 characters long, then it updates