How can I use a function from class MainPage in class AddPart? I have some functions in class Mainpage and I want to use all the functions that are in class MainPage in another class AddPart.
class MainPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent) #initialise parent class --> TSS()
def main_heading(self, heading):
main_label = tk.Label(self, text = heading, font = LARGE_FONT, fg = 'white', bg = 'RoyalBlue1', width = 1000, height = 4)
main_label.pack(side = 'top')
def sub_heading(self, title):
sub_label = tk.Label(self, text = title, font = MED_FONT, fg = 'RoyalBlue2')
sub_label.pack(side = 'top', padx = 20, pady = 20)
def paragraph(self, para):
paragraph_label = tk.Label(self, text = para, font = SMALL_FONT, fg = 'gray26')
paragraph_label.pack(side = 'top', padx = 20, pady = 20)
def top_tool(self):
toolbar = tk.Frame(self, bg = 'RoyalBlue2')
AddBtn = tk.Button(toolbar, text = 'ADD', width = 10, bg = 'RoyalBlue2', fg = 'white', borderwidth=0)
AddBtn.pack(side = 'left', padx = 0, pady = 0)
RemBtn = tk.Button(toolbar, text = 'REMOVE', width = 10, bg = 'RoyalBlue2', fg = 'white', borderwidth=0)
RemBtn.pack(side = 'left', padx = 0, pady = 0)
RevBtn = tk.Button(toolbar, text = 'REVIEW', width = 10, bg = 'RoyalBlue2', fg = 'white', borderwidth=0)
RevBtn.pack(side = 'left', padx = 0, pady = 0)
AssignBtn = tk.Button(toolbar, text = 'ASSIGN EVENTS', width = 15, bg = 'RoyalBlue2', fg = 'white', borderwidth=0)
AssignBtn.pack(side = 'left', padx = 0, pady = 0)
toolbar.pack(side = 'top', fill = 'x')
#-----Second Class------
class AddPart(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.top_tool()
self.main_heading("Home")
def main_heading(self, heading):
main_label = tk.Label(self, text = heading, font = LARGE_FONT, fg = 'white', bg = 'RoyalBlue1', width = 1000, height = 4)
main_label.pack(side = 'top')