I am new to the Python universe. I am learning to use language. I would like to learn how create a table space within an application. I would like to understand the following code (available at https://pandastable.readthedocs.io/en/latest/examples.html), in particular some parts such as:
1 - Why did "Frame" enter parentheses: "TestApp (Frame)"?
2 - Why was init called after Frame: Frame .__ init __ (self)?
3 - I didn't understand the reason for the relationship: self.main = self.master.
4 - In app.mainloop (), why app? Usually we use the main window, but app is not window, before it is calling the class.
Code:
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()