title: python tkinter listbox to be update on each button click
body: <p>Below is the piece of code where i am trying to search a pattern in text box and then getting the result in listbox. On clicking each line in listbox , it will show the text box.</p>
  
  <p>I am facing one issue, each time i click on the Search button, it creates a new listbox instead of updating the parent listbox. How can i achieve this. Please advise.</p>
  
  <pre><code>import pysftp
  import sys
  import spur
  import paramiko
  from Tkinter import *
  
  
  
  message =""
  
  
  ssh = paramiko.SSHClient()
  ssh.set_missing_host_key_policy(
      paramiko.AutoAddPolicy())
  ssh.connect('hostname', username='user', password='password')
  
  
  
  root = Tk()
  
  
  L1 = Label(root, text="Pattern")
  L1.pack( side = LEFT)
  E1 = Entry(root, bd =5)
  
  E1.pack(side = LEFT)
  
  def OnDouble(event):
          master = Tk()
          widget = event.widget
          selection=widget.curselection()
          value = widget.get(selection[0])
          #print "selection:", selection, ": '%s'" % value
          command="~/Format.sh "+ value
          ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(command)
          data = ssh_stdout.readlines()
          xscrollbar = Scrollbar(master, orient=HORIZONTAL)
          yscrollbar = Scrollbar(master)
          yscrollbar.pack( side = RIGHT, fill=Y )
          xscrollbar.pack( side = BOTTOM, fill=X )
          #print data
          text = Text(master, width=100,yscrollcommand = yscrollbar.set, xscrollcommand = xscrollbar.set)
          for line in data:
           text.insert(INSERT, line)
          text.insert(END, "Bye Bye.....")
          text.pack(side = LEFT, fill = BOTH)
          xscrollbar.config( command = text.xview)
          yscrollbar.config( command = text.yview)
  
  
  
  def callback():
      message= E1.get()
      command="~/IndexSearch_py.sh "+ message
      ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(command)
  
  
      data = ssh_stdout.readlines()
      xscrollbar = Scrollbar(root, orient=HORIZONTAL)
      yscrollbar = Scrollbar(root)
      yscrollbar.pack( side = RIGHT, fill=Y )
      xscrollbar.pack( side = BOTTOM, fill=X )
  
      mylist = Listbox(root, width=80,yscrollcommand = yscrollbar.set, xscrollcommand = xscrollbar.set )
      length=len(data);
      for i in range(length):
       mylist.insert(END, data[i])
      print mylist.size()
  
  
  
  
      mylist.bind("&lt;Double-Button-1&gt;", OnDouble)
      mylist.pack( side = LEFT, fill = BOTH )
  
      xscrollbar.config( command = mylist.xview)
      yscrollbar.config( command = mylist.yview)
  
  
  
  
  b = Button(root, text="Search", width=20, command=callback)
  b.pack()
  
  
  mainloop()
  </code></pre>