title: when will Text widget update after insert a text
body: <p>I create a simple GUI which contain a <strong>button</strong> and a <strong>text widget (TextArea)</strong>. My business is when I click the button, the text widget will be insert some text.</p>
  
  <p>At my attached image, After the GUI appeared, I clicked the button and I'm in breakpoint at line 9, my expectation is the text widget have 2 lines: text1, text2</p>
  
  <p>However, nothing is showed until the function callback is finished</p>
  
  <p><a href="https://i.stack.imgur.com/bQLJA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bQLJA.png" alt="The debug status"></a></p>
  
  <pre class="lang-py prettyprint-override"><code>from tkinter import *
  
  master = Tk()
  
  def callback(text: Text):
      text.delete('1.0', END)
      text.insert(END, 'text1\r\n')
      text.insert(END, 'text2\r\n')
      text.insert(END, 'text3\r\n')
      text.insert(END, 'text4\r\n')
      text.insert(END, 'text5\r\n')
      text.insert(END, 'text6\r\n')
      text.insert(END, 'text7\r\n')
  
  textwidget = Text(master)
  textwidget .pack()
  b = Button(master, text="OK", command=lambda :callback(textwidget))
  b.pack()
  
  mainloop()
  </code></pre>
  
  <p>My question is How can I force the gui update immediately after execute insert method of textwidget.</p>
  
  <p><b>Update</b></p>
  
  <p>Thank you for @Saad recommendation, I update the code (insert text.update() at line 9) and I can see the text appear in text widget</p>
  
  <pre class="lang-py prettyprint-override"><code>def callback(text: Text):
      text.delete('1.0', END)
      text.insert(END, 'text1\r\n')
      text.insert(END, 'text2\r\n')
      text.update()
      text.insert(END, 'text3\r\n')
      text.insert(END, 'text4\r\n')
      text.insert(END, 'text5\r\n')
      text.insert(END, 'text6\r\n')
      text.insert(END, 'text7\r\n')
  </code></pre>