2014-11-10 5 views
0

사용자로부터 입력을 받아 pandas 데이터 프레임을 출력하는 프레임에 Tkinter 텍스트 위젯이 있습니다. Tkinter 위젯에서보기 전용 테이블로 데이터 프레임을 출력하려고합니다. 여기 내가 이미 가지고있는 것입니다 -클릭시 Tkinter 위젯에 데이터 프레임 표시

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 

나는 Tkinter 위젯에서 반환 된 데이터 프레임 인 do_stuff()를 표시하려고합니다. 관련 질문을 검색했지만 해결책을 찾을 수 없어 여기에 게시하고 있습니다. 어떤 도움을 주셔서 감사합니다! 감사합니다.

답변

1

내가 찾고있는 것을 찾았습니다. TopLevel 위젯을 사용하면 내가 놀고 팝업을 표시 할 다른 '루트'를 정의 할 수 있습니다.

관련 문제