title: Entry Widget in Tkinter with <Key> Bind
body: <p>Can anyone help me determine why the print statements seem to lag behind the input for this code? If you run this short program and type 1,2,3,4,5 into the input entry widget, the  event triggering the method gets the current value of the typed_string Stringvar, but it lags 1 behind the input. Can someone explain why? Better yet, does anyone know of a way that any keypress to an entry widget that produces text will call the displayed value of the input variable? Current version of python is 3.8</p>
  <pre class="lang-py prettyprint-override"><code>
  import tkinter
  from tkinter import *
  
  class UI():
      def __init__(self, master):
          self.typed_string = StringVar()
          self.typed_string.set(&quot;&quot;)
  
          self.new_entry = tkinter.Entry(master, textvariable=self.typed_string)
          self.new_entry.pack()
          self.new_entry.bind(&quot;&lt;Key&gt;&quot;,self.check_string)
  
      def check_string(self, event):
          retrieved_string = self.typed_string.get()
          print(retrieved_string, &quot; was retrieved string&quot;)
          print(self.new_entry.get(), &quot; was get for entry widget&quot;)
  
  def main():
      root = Tk()
      new_ui = UI(root)
      root.mainloop()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/5SQSr.png" rel="nofollow noreferrer">input field with terminal output shown</a></p>