title: Readonly tkinter text widget
body: <p>I want to use <code>tkinter text widget</code> as a <code>readonly</code> widget. It should act as a <code>transcript</code> area. My idea is to keep this transcript in a <code>file</code> and whenever the user writes anything, just remove all the contents of the widget, and rewrite it again.</p>
  
  <p>The code will look like:</p>
  
  <pre><code>transcript_entry = SimpleEditor()  # SimpleEditor is inherited from ScrolledText
  transcript_entry.text.delete("1.0", END)
  
  # this is just a test string, it should be the contents of the transcript file
  transcript_entry.text.insert("1.0", "This is test transcript")  
  transcript_entry.text.bind("&lt;KeyPress&gt;", transcript_entry.readonly)
  </code></pre>
  
  <p>And <code>readonly</code> function will look like:</p>
  
  <pre><code>def readonly(self, event):
      self.text.delete("1.0", END)
      # this is just a test string, it should be the contents of the transcript file
      self.text.insert("1.0", "This is test transcript")
  </code></pre>
  
  <p>The bug here is that the last character entered by the user is added to the transcript. I suspect the reason is that the readonly function is called, <code>then</code> the user input is wrote to the widget. How to reverse this order &amp; let the readonly function be called <code>after</code> the user input is wrote to the widget?</p>
  
  <p>Any hints?</p>