I have organized my GUI with a parent app class which inherits from tk.Frame. In the main main app I create a top level window object which is a pop up when a button is pressed. This class inherits from tk.Toplevel. The Toplevel should have its own widgets which need to be organized neatly. I am wondering what is the best way to organize the widgets on the Toplevel. Below is the code which shows the overall structure of the GUI I am trying to write. The submit_button class is where widgets need to be organized properly.
import tkinter as tk
from tkinter import ttk
class Window(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.title = "TITLE"
self.master = master
self.submit = ttk.Button(self, text = 'SUBMIT', command = self.click_submit_button)
self.submit.grid(row = 0, column = 2, padx = 20, pady = 20)
def click_submit_button(self):
self.submit_pop_up = submit_button(self.master)
class submit_button(tk.Toplevel):
def __init__(self, master):
tk.Toplevel.__init__(self, master)
self.master = master
self.title = 'TITLE'
if __name__ == "__main__":
root = tk.Tk()
app = Window(root)
app.pack()
root.mainloop()