I'm trying to build Tabs in my program. Each Tab has difrrent functions,Labels,Entries and so on...
My idea is to create something like a mainTab file that create all the tabs.
Is it possible to inherit from the mainTab
file and create Tab classes as much as i want?
I want to separate each Tab class, because each class has alot methods and i dont want to write the whole tab classes on one file.
Is it possible to create?
If it is, how can i create instanse of the tab and connect it to the tab_control
?
For example: This is what i wrote, all tabs in one classes (which i don't want to create it like that)
class CreateLayout:
def __init__(self, window):
self.window = window
window.title('TITLE')
window.geometry('800x600')
# Create Tab Control
tab_control = ttk.Notebook(window)
# Tab1
tab1 = ttk.Frame(tab_control)
tab_control.add(tab1, text='Hashtag')
tab_control.pack(expand=1, fill="both")
# Tab2
tab2 = ttk.Frame(tab_control)
tab_control.add(tab2, text='Following me')
tab_control.pack(expand=1, fill="both")
I want to create sub classes(Tabs) that inherit from CreateLayout
class, and on each sub class write it own Tab logic with methods, layout and more...
I hope my question is clear, if not please let me know.
Bottom line, what i want to create is classes that inherit from the CreateLayout
and in the CreateLayout
build the tabs.
For example
class CreateLayout:
def __init__(self, window):
self.window = window
tab_control = ttk.Notebook(window)
tab1 = Tab1(window)
tab_control.add(tab1, text='Hashtag')
something like that.