Created
May 8, 2017 16:44
-
-
Save gugat/7cf57eb628f3bb0a3d54b3f8d0023b63 to your computer and use it in GitHub Desktop.
Show Pandas dataframe as table with Tkinter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Taken from https://github.com/dmnfarrell/pandastable/wiki/Code-Examples | |
| from tkinter import * | |
| from pandastable import Table, TableModel | |
| class TestApp(Frame): | |
| """Basic test frame for the table""" | |
| def __init__(self, parent=None): | |
| self.parent = parent | |
| Frame.__init__(self) | |
| self.main = self.master | |
| self.main.geometry('600x400+200+100') | |
| self.main.title('Table app') | |
| f = Frame(self.main) | |
| f.pack(fill=BOTH,expand=1) | |
| df = TableModel.getSampleData() | |
| self.table = pt = Table(f, dataframe=df, | |
| showtoolbar=True, showstatusbar=True) | |
| pt.show() | |
| return | |
| app = TestApp() | |
| #launch the app | |
| app.mainloop() |
Hi,
This example is good, only have one problem that i can't fix, if you run again the example (by second time) send the next error message :
TclError: invalid command name ".!canvas"
Can someone please help me with this error!!!
I am getting the same error. Did anybody figure this out?
once i load & display the data in the table app Frame , cant able to close the frame again. Kindly let me know how to close
Also running into this error- anybody figure it out?
Running python 3.9-dev -- work-around for not being able to close and re-run problem: remove/comment out app.mainloop()
Best guess for why, the mainloop attaches itself to the host so closing the canvas does not kill the process
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
This example is good, only have one problem that i can't fix, if you run again the example (by second time) send the next error message :
TclError: invalid command name ".!canvas"
Can someone please help me with this error!!!