Object-oriented approach on switching frames in tkinter using a sidebar

Question:

I was developing a simple clock app which includes the features of: clock, timer, stopwatch and potentially world clock with live conversions – just a project to get me back into programming. To challenge myself, I wanted to make it under an object oriented approach of which I set a main object with methods.

What I am struggling with is with the sidebar functionality, I already have it and it looks to my liking, but I am struggling to reference it with the current frame of what will be appearing "in the red box" to switch it with the other menus of the other technology in my app. Yes, I save it under a frame and try to use the switch_frame function, however, I am in questioning of how to reference each instance of the object’s frame.

Image of the running tkinter app with the sidebar and the frame of which changes menus highlighted in red

PS: I have the class as a ttkbootstrap object in order to have a better looking app.

"""
Goofy agh clock app to get me back into programming.
To make it harder, I limited it to only Object-Oriented programming and also uses ttkboostrap to at least make it
remotely look good.

Features:
Clock, timer (with included sounds), stop watch.
"""


from PIL import Image, ImageTk

import tkinter as tk
import ttkbootstrap as ttb
from ttkbootstrap.constants import *
from datetime import *


class ClockApp:
    def __init__(self):
        self.root = ttb.Window(themename="darkly")
        self.root.title("Clock")
        self.root.geometry("500x500")
        self.root.resizable(False, False)
        self.root.iconphoto(False, ImageTk.PhotoImage(file="clock_icon.png"))

        self.side_panel = ttb.Frame(self.root, width=75, height=500, bootstyle="info")
        self.side_panel.grid(rowspan=4, column=0)

        clock_image = Image.open("clock_icon.png")
        resized_clock = clock_image.resize((50, 50))
        timer_image = Image.open("timer_icon.png")
        resized_timer = timer_image.resize((50, 50))

        used_clock_image = ImageTk.PhotoImage(resized_clock)
        used_timer_image = ImageTk.PhotoImage(resized_timer)

        self.clock_button = ttb.Button(self.root, image=used_clock_image, bootstyle=INFO)
        self.clock_button.image = used_clock_image
        self.clock_button.grid(row=0, column=0)

        self.timer_button = ttb.Button(self.root, image=used_timer_image, bootstyle=INFO)
        self.timer_button.image = used_timer_image
        self.timer_button.grid(row=1, column=0)

    def update_time(self):
        new_time = datetime.now()
        new_string_time = new_time.strftime("%H : %M : %S")

        time_label.config(text=new_string_time)
        self.root.after(1000, self.update_time)

    def switch_frame(self, current_frame, new_frame):
        print("Button has been pressed")

    def side_buttons_manager(self, button):
        pass


if __name__ == '__main__':
    clock = ClockApp()

    now_time = datetime.now()
    string_time = now_time.strftime("%H : %M : %S")

    time_frame = ttb.Frame(clock.root)
    time_frame.grid(row=1, column=1)

    time_label = ttb.Label(time_frame, text=string_time,
                           font=("Arial Greek", 32, "bold"), bootstyle=INFO)
    time_label.grid(row=1, column=0, padx=100)
    clock.update_time()

    stopwatch_frame = ttb.Frame(clock.root)
    stopwatch_label = ttb.Label(stopwatch_frame, text="This is another Frame for testing")

    # I want to somehow select the button object from my class but I guess, I can not change or add attributes to the button widget or when selecting it, it would create a new one when I set the grid layout of it (ofc it would but I have no idea how to reference it from the object).



    clock.root.mainloop()

I have tried to call the button object inside the main object in order to add a command attribute to it however it was unable to work as that is wrong syntax with it. Is there a way I can do this or I have to differ the very construction of my object?

Should I create multiple objects of each containing their frames of features? If so, how can I recycle the sidebar content I had to make the very aspect of the object oriented approach even worth it?

I would like at least the thought process behind the construction with the OOP approach with tkinter and ttkbootstrap however I will really appreciate if there is any example code for how this would work – with annotated theory in just few key lines of code.

Thank you in advance, I will edit this post if I find anything otherwise.

Answers:

It has come from the great comment of "JRiggles" that I can instead have each Frame be their own object of which I can call whenever I want where they have their own associated methods grouped with each component/section the app. Thank you!

However, now I would simply need to create another function to be a manager of which frames would be shown