I'm trying to familiarize myself with tkinter and I created a dummy "app" which has multiple frames and in each frames has multiple widgets.
For example:
import tkinter as tk
if __name__ == "__main__":
window = Tk()
window.title("somename")
window.geometry("400x400")
frame1 = tk.Frame(window)
frame1.grid(row = 0, column = 0)
label1 = tk.Label(frame1, text = "this is frame1")
label1.pack()
button1 = tk.Button(frame1)
button1.pack()
frame2 = tk.Frame(window)
frame2.grid(row = 1, column = 0)
label2 = tk.Label(frame2, text = "this is frame2")
label2.pack()
button2 = tk.Button(frame2)
button2.pack()
So far this format works, however its very messy and I also need the return values of the buttons using command (like filename from askopenfilename, values from CheckButton, etc) and I think OOP will be a good choice as it encapsulates information, however, am not very familiar with OOP as I mostly use python for scripting in jupyter.
My question is, if I should use classes, how should I partition the class? Should I separate each frames with elements in it as an object, or something else?
Edit: I should've said that each frame has a label but different type of widgets. Thank you @Henry Yik for the link, but my question is whether using class necessary when the only similarity between frames are the frame itself and a label, and nothing else.