I have a Tkinter text widget in a frame that takes input from the user and outputs a pandas data-frame. I am trying to output the data-frame as a view only table in a Tkinter widget. Here is what I already have -
class App(object):
def __init__(self):
self.root = tki.Tk()
self.root.title="Shapley Value Computation"
txt_frm = tki.Frame(self.root, width=900, height=500)
txt_frm.pack(fill="both", expand=True)
txt_frm.grid_propagate(False)
txt_frm.grid_rowconfigure(0, weight=1)
txt_frm.grid_columnconfigure(0, weight=1)
self.txt = tki.Text(txt_frm, borderwidth=3, relief="sunken")
self.txt.config(font=("consolas", 12), undo=True, wrap='word')
self.txt.grid(row=0, column=0, sticky="nsew", padx=2, pady=2)
scrollb = tki.Scrollbar(txt_frm, command=self.txt.yview)
scrollb.grid(row=0, column=1, sticky='nsew')
self.txt['yscrollcommand'] = scrollb.set
tki.Button(txt_frm, text='Shapley it', command=self.do_stuff).grid(row=1, column=0)
def do_stuff(self):
#Compute Shapley Value and return a dataframe
I want to display the returned data frame of do_stuff() in a Tkinter widget. I searched for the relevant question but could not find a solution and am hence posting it here. Any help is appreciated! Thank you!