0

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!

1 Answer 1

1

I found what I was looking for. The TopLevel widget allows me to define another 'root' with which I get to play around and display popups

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.