Skip to content

Commit

Permalink
Add TabView, main, settings tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
jake158 committed Mar 5, 2024
1 parent 2166432 commit edb67f7
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
import customtkinter as ctk

MAIN_RED = "#eb4034"
RED_HOVER = "#f75a4f"

ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("blue")
ctk.set_default_color_theme("themes/Default.json")


class PomodoroFrame(ctk.CTkFrame):
def __init__(self, master, start_func):
def __init__(self, master):
super().__init__(master)

# Placeholder
self.timer_display = ctk.CTkLabel(self, text="00:25:00", font=("Helvetica", 48))
self.timer_display = ctk.CTkLabel(self, text="25:00", font=("Helvetica", 58))
self.timer_display.pack(pady=50)

self.start_button = ctk.CTkButton(self, text="Start", fg_color="transparent", border_color=MAIN_RED,
border_width=2, corner_radius=32, hover_color=RED_HOVER, command=start_func)
self.start_button = ctk.CTkButton(self, text="Start", fg_color="transparent",
border_width=2, corner_radius=32, command=self.start_timer)
self.start_button.pack()

def start_timer(self):
print("Timer started")


class TabView(ctk.CTkTabview):
def __init__(self, master, **kwargs):
super().__init__(master, **kwargs)

self.add("Main")
self.add("Settings")

self.main_frame = PomodoroFrame(self.tab("Main"))
self.main_frame.pack()


class PomodoroApp(ctk.CTk):
WIDTH = 400
HEIGHT = 400
WIDTH = 350
HEIGHT = 350

def __init__(self):
super().__init__()

self.title("Pomodoro Tracker")
self.geometry(f"{PomodoroApp.WIDTH}x{PomodoroApp.HEIGHT}")

tabview = ctk.CTkTabview(master=self)
tabview.pack(padx=20, pady=20)

tabview.add("Main")
tabview.add("Settings")

self.main_frame = PomodoroFrame(tabview.tab("Main"), self.start_timer)
self.main_frame.pack()

def start_timer(self):
print("Timer started")
self.tabview = TabView(master=self)
self.tabview.pack(pady=30)


if __name__ == "__main__":
Expand Down

0 comments on commit edb67f7

Please sign in to comment.