Here is my code:
class ProjectApp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
self.filepaths = []
class StartPage(tk.Frame):
def __init__(self, parent, controller, *args, **kwargs):
tk.Frame.__init__(self, parent, *args, **kwargs)
self.controller = controller
self.parent = parent
def get_file(self):
filepath = askopenfilename()
if filepath:
print(ProjectApp.filepaths)
self.parent.filepaths.append(filepath)
I am trying to use filepath in another class but I got the error below.
AttributeError: type object 'ProjectApp' has no attribute 'filepaths'
Can you tell me where is the mistake?
filepathsis bound to an instance, not the class.ProjectApp().filepaths