title: Tkinter, update tree with sqlite3 : OperationalError: no such table: tree
body: <p>A couple of days ago I started making my first GUI software and I reached the stage where I have set up my labels/buttons/entries, connected the entries to an SQL database, created a tree list that shows up in the frame I want, and populated the tree with the database (i.e. the correct entries show up in the correct columns in the tree) so all this works fine. 
  Right now I don't have a correct function to update the tree, so each time I run the programme (for testing purposes), it has saved the current list of entries and adds the new ones over and over, so I have a list of dozens of rows from all the tests I have run.</p>
  
  <p>Here is my attempt to add an update function: </p>
  
  <pre><code>def treeUpdate(): 
      for child in tree.get_children():          
          print(child)                       ## nothing is printed out here 
          tree.delete(child)
      c.execute('SELECT column1, column2, column3, column4 FROM tree')
      records = c.fetchall()
      for i in records: 
          tree.insert("", "end", text ="", values=(i[0],i[1],i[2],i[3]))
      conn.close()
  </code></pre>
  
  <p>The error I Get is: </p>
  
  <blockquote>
    <p>OperationalError: no such table: tree</p>
  </blockquote>
  
  <p>And here is part of the tree code: </p>
  
  <pre><code>tree = ttk.Treeview(BottomFrame)
  tree['columns'] = ('column1','column2', 'column3','column4')
  tree.heading("#0", text = '', anchor = "w")
  tree.column("#0", width = 5, anchor = 'center', stretch = tk.NO)
  tree.heading("#1", text = 'File Name', anchor = "w")
  tree.heading("#2", text = 'Archive Interval',anchor = "w")
  tree.heading("#3", text = 'Delete Interval',anchor = "w")
  tree.heading("#4", text = 'Output Directory',anchor = "w")
  tree.pack(fill = "both")
  print("tree created")         ## this is printed successfully 
  </code></pre>
  
  <p>I get that tree is not an sql table, so I guess you can not use sql commands to manipulate the tree? Is there any other way this can be done? 
  If it is of any help, I have included the update function in the function which adds the new entries to the database (see below), but not the function which retrieves the records and adds them to the tree. </p>
  
  <pre><code>def Add(): 
      conn = sqlite3.connect('FilesToArchive.db')
      c = conn.cursor()
      c.execute("INSERT INTO Files VALUES (:Filename, :Time_Interval, :Delete_Interval, :Destination)",
              {
                 'Filename': str(filedir.get()),
                 'Time_Interval': Interval.get(),
                 'Delete_Interval': DelInt.get(),
                 'Destination': str(outputdir.get())
              }
          )
      conn.commit()       
      treeUpdate()
      #c.close()                          
      pass
  </code></pre>