I am trying to create an application where within the main frame, there are two other frames (side to side).
The left frame consist of buttons that are always visible. Those buttons will change the contents of the right frame.
I have done this successfully by assigning each button to a definition which recreates the buttons in the left frame, clears the content on the right frame and rewrite what goes into the right frame.
This works, but I would love to learn more on different/more efficient ways of doing this.
I have been searching for the last couple of days on how I can include classes and this is what I have found.
class SeaofBTCapp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
container = tk.Frame(self)
container.pack(side="top", fill="both", expand = True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
frame = StartPage(container, self)
self.frames[StartPage] = frame
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame(StartPage)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
This class helps create a controller where you can navigate through frames.
The problem i'm having is creating a frame that is always visible since, def show_frame
changes the contents of the entire window.
I had an idea where I can add this structure into a class called 'RightFrame' that isn't the main window, but I have no idea how I would make the frames and buttons communicate with each other.
I am a complete beginner at coding so any pointers would be appreciated.