Aug-20-2020, 11:03 AM
You should only use
Comments_Tab
when creating an instance of Comments_Tab. Comments_Tab does not have any class or static resources, so everything should be called/referenced using an instance.test_button = Button(self, text="Show Data", command=lambda: Comments_Tab.test(self))should be
test_button = Button(self, text="Show Data", command=self.test)
def test(self): Comments_Tab(self).historical_entry_market.insert(0, "asd")should be
def test(self): self.historical_entry_market.insert(0, "asd")Why are you doing this
page1 = Rents_Tab(self.notebook) self.notebook.add(page1, text="Rents") page2 = Comments_Tab(self.notebook) self.notebook.add(page2, text="Comments")instead of this?
self.notebook.add(Rents_Tab(self.notebook), text="Rents") self.notebook.add(Comments_Tab(self.notebook), text="Comments")Or better yet add the pages in the tab classes:
# in main.py Rents_Tab(self.notebook, "Rents") Comments_Tab(self.notebook, "Comments") #in comments.py class Comments_Tab(tk.Frame): def __init__(self, parent, title, *args, **kwargs): super().__init__(parent, *args, **kwargs) parent.add(self, text=title)