title: How to delete a character right after it was entered in Tkinter?
body: <p>As stated in the title, I'm trying to delete a character right after it was entered into a text field.</p>
  <pre class="lang-py prettyprint-override"><code>import tkinter as tk
  
  window = tk.Tk()
  input = tk.Text()
  input.pack()
  
  
  def handle_keypress(event):
    print(&quot;test&quot;)
    input.delete(&quot;1.0&quot;)
  
  input.bind(&quot;&lt;Key&gt;&quot;, handle_keypress)
  
  window.mainloop()
  
  </code></pre>
  <p>The following code deletes the character only after another one is typed. The print statement, however, works instanly as expected. I wonder what is causing this behaviour and how it can be fixed. Thankful for any clue.</p>