title: Displaying Pandas dataframe in tkinter
body: <p>I'm creating a tkinter gui that will take user input for a variable that then gets passed to SQL and the queried data (in this case a single column data frame and boxplot). However, at this moment I can not find a means of displaying my pandas dataframe in the tk gui. I have not found any module or means of displaying this, and I've spent hours going through possible solutions to no avail. Only thing I need is for the dataframe to display in the gui and be re-rendered each time I change the dataframe through the user input function. My code atm is:</p>
  
  <pre><code>### Starting first GUI/Tkinter Script
  ##First load libs
  
  import pyodbc
  import numpy as np
  import pandas.io.sql as sql
  import pandas
  import matplotlib.pyplot as plt
  import pylab 
  import matplotlib as mpl
  from tkinter import *
  import sys
  
  plt.ion()
  
  def userinput():
    global PartN, pp, df
    ##a = raw_input(v.get())
    a = E1.get()
    ##print a
    PartN = a
    conn = pyodbc.connect('DRIVER={SQL Server};SERVER=my server;
    DATABASE=PackingList;UID=myid;PWD=mypword') 
    sqlr = "SELECT partmadeperhour FROM Completions WHERE  PartNumber = ? 
    AND endtime &gt; '2012-12-31 23:59:00' ORDER BY partmadeperhour"
    df = pandas.read_sql_query(sqlr, conn, params=[PartN])
    conn.close()
    print(df)
  
  
   stats = df['partmadeperhour'].describe()
    print(stats) 
    print("Part Name is %s" %PartN)
    ##df.plot(kind='box', fontsize='20')
    pp =  df.plot(kind='box', fontsize='20')
    plt.show(block=True)
  
  
  def clear_textbox():
      E1.delete(0, END)
  
  master = Tk()
  master.title('Title')
  
  
  v = StringVar()
  PartN = None
  
  L1 = Label(master, text = 'Name')
  L1.pack(side = LEFT)
  
  E1 = Entry(master, textvariable = v, bd = 5)
  E1.pack(side = RIGHT)   
  
  b = Button(master, text = 'Submit', command = userinput)
  b.pack(side = TOP)
  
  b2 = Button(master, text = 'Clear', command=clear_textbox)
  b2.pack(side=BOTTOM)
  
  master.mainloop()
  </code></pre>
  
  <p>An example of my data frame </p>
  
  <pre><code>       rate
  0      [0.25]
  1      [0.67]
  2      [0.93]
  ...       ...
  1474   [5400.00]
  </code></pre>
  
  <p>If someone could just point me in the right direction, I don't even need code corrections just yet, I just need to hear someone to say yes it is possible (which I know it is), and to give me some kind of example. Thanks</p>