title: Update text widget in tkinter from function
body: <p><strong>The problem:</strong></p>
  <p>I am trying to update the same text widget box from a function that contains some text. Instead a whole new text window appears every time.</p>
  <p><strong>Here is my code:</strong></p>
  <pre><code>from tkinter import *
  import os
  
  #Tkinter graphics
  
  homepage = Tk()
  homepage.title(&quot;My first GUI&quot;)
  # set size of window
  homepage.geometry('1200x400')
  # Add image file 
  bg = PhotoImage(file = &quot;maxresdefault.png&quot;) 
      
  # Show image using label 
  label1 = Label( homepage, image = bg) 
  label1.place(x = 0, y = 0) 
  
  label2 = Label( homepage, text = &quot;Test App&quot;) 
  label2.pack() 
  
  # Create Frame 
  frame1 = Frame(homepage) 
  frame1.pack()
  
  #button initatiors
  def buttonupdate():
      S = Scrollbar(homepage)
      T = Text(homepage, height=100, width=30)
      T.pack()
      T.pack(side=RIGHT, fill= Y)
      S.pack(side = RIGHT, fill = Y)
      S.config(command=T.yview)
      T.insert(END, &quot;test&quot;)
      T.config(yscrollcommand=S.set, state=DISABLED)
  
  
      
  
  # Static buttons
  tickets30button = Button(text = &quot;This is button 1&quot;, command=buttonupdate) 
  tickets30button.place(x=0, y=26) 
  
  mcibutton = Button(text = &quot;This is button 2&quot;) 
  mcibutton.place(x=0, y=52)
  
  hdebutton = Button(text = &quot;This is button 3&quot;)
  hdebutton.place(x=0, y=78)
  
  homepage.mainloop()
  </code></pre>
  <p>Here is the result if I click on the first button three times:
  <img src="https://i.ibb.co/HG4nY0c/problem1.png" alt="" /></p>
  <p>Let me know if you have any suggestions that I can try.</p>
  <p>Thank you for your time,</p>