title: Tkinter input to excel spreadsheet
body: <p>I am working on a Tkinter app that takes input and outputs excel data. I cannot get the entry for size or any other entry field. I want the entry to be obtained and stored in the excel file when the user selects finish order. What change does the code need?
  so far everything works except that I do not know how to get the data from the entry because when the button is clicked it runs the code again and thus erases the values.</p>
  
  <pre><code>import datetime
  import tkinter as tk
  import xlwt as xl
  from datetime import datetime
  
  style1 = xl.XFStyle()
  style1.num_format_str = "D-MM-YY"
  
  wb = xl.Workbook()
  
  
  sheet1 = wb.add_sheet("Sheet1", cell_overwrite_ok=True)
  sheet1.write(0, 0, datetime.now(), style1)
  
  sheet1.write(0, 1, "Item")
  sheet1.write(0, 2, "Size")
  sheet1.write(0, 3, "Quantity")
  
  
  window = tk.Tk()
  window.geometry("500x500")
  window.title("Furniture order")
  
  
  item_label = tk.Label(text="Select your item ")
  item_label.grid(column= 5, row=0)
  
  
  def destroy ():
      item_label.destroy()
      table_button.destroy()
      chair_button1.destroy()
  
  
  def options ():
      size_label = tk.Label(text="Enter the size")
      size_label.grid(column=0, row=0)
      color_label = tk.Label(text="Enter the color")
      color_label.grid(column=0, row=1)
      quantity_label = tk.Label(text="Enter the quantity")
      quantity_label.grid(column=0, row=2)
  
      done_button = tk.Button(text="Finish the order", command=get_data)
      done_button.grid(column=1, row=4)
  
  
  
  def entry ():
      size_entry = tk.Entry(window)
      size_entry.grid(column=2, row=0)
      color_entry = tk.Entry()
      color_entry.grid(column=2, row=1)
      quantity_entry = tk.Entry()
      quantity_entry.grid(column=2, row=2)
  
      return size_entry.get()
  
  def get_data ():
      size = entry()
      sheet1.write(1, 1, "table")
      sheet1.write(1, 2, size)
      wb.save("test2.xls")
  
  
  
  
  def t_d ():
      destroy()
      options()
      entry()
  
  
  def c_d ():
      destroy()
      options()
      entry()
  
  
  
  chair_button1 = tk.Button(text="Chair", command=t_d)
  chair_button1.grid(column=0, row=3)
  
  table_button = tk.Button(text="Table", command=c_d)
  table_button.grid(column=10, row=3)
  
  
  wb.save("test2.xls")
  window.mainloop()
  </code></pre>