diff --git a/main.py b/main.py index a6ec855..2780b27 100644 --- a/main.py +++ b/main.py @@ -17,12 +17,13 @@ distractions = 0 width = 120 height = 140 -app = tk.Tk() +app = tk.Tk(className="focustimer") app.title("Focus-Timer") app.configure(background="#17153B") app.geometry(f"{width}x{height}") app.minsize(width, height) app.maxsize(width, height) +app.update() app.resizable(False, False) @@ -30,9 +31,9 @@ def tick(): global seconds_left, current_state match current_state: - case STATE_IDLE: + case "IDLE": return - case STATE_OVERTIME: + case "OVERTIME": seconds_left += 1 case _: seconds_left -= 1 @@ -55,7 +56,7 @@ def handle_transition(): match current_state: case "FOCUS": current_state = STATE_WORK - seconds_left = 4200 # 70 min + seconds_left = 4200 distractions = 0 case "WORK": @@ -66,6 +67,7 @@ def handle_transition(): current_state = STATE_IDLE seconds_left = 0 + update_timer_label() update_ui() def start_button_f(): @@ -99,6 +101,7 @@ def break_button_f(): seconds_left = 1500 update_timer_label() + create_post() update_ui() def complete_task_button_f(): @@ -138,46 +141,47 @@ def update_ui(): match current_state: case "IDLE": - text_label.config(text="Wanna start?") - timer_label.config(text="00:20:00") + text_label.config(text="Wanna start?", fg="#C8ACD6") + timer_label.config(text="00:20:00", fg="#C8ACD6") + start_button.config(fg="#c8acd6", activebackground="#c8acd6") start_button.pack(side="bottom",pady="15") case "FOCUS": - text_label.config(text="Time to focus!") - timer_label.config() + text_label.config(text="Time to focus!", fg="red") + timer_label.config(fg="red") distracted_button.pack(side="bottom", pady="15") case "WORK": - text_label.config(text="Work.") - timer_label.config() + text_label.config(text="Work.", fg="aqua") + timer_label.config(fg="aqua") complete_task_button.pack(side="bottom", pady="15") case "OVERTIME": - text_label.config(text="Maybe a break?") - timer_label.config() + text_label.config(text="Maybe a break?", fg="orange") + timer_label.config(fg="orange") break_button.pack(side="bottom", pady="15") case "BREAK": - text_label.config(text="Relax..") - timer_label.config() + text_label.config(text="Relax..", fg="yellow") + timer_label.config(fg="yellow") + + start_button.config(fg="yellow", activebackground="yellow") start_button.pack(side="bottom", pady="15") -text_label = tk.Label(app, text="", font=("Helvetica", 14)) +text_label = tk.Label(app, font=("Helvetica", 14, "bold"), bg="#17153b") text_label.pack(side="top", pady="15") timer_label = tk.Label(app, text="hh:mm:ss",fg="#C8ACD6",background="#17153B",font=("Helvetica", 25) , anchor="center") timer_label.pack(expand=True,fill="y") -start_button = tk.Button(app, text="Start.", command=start_button_f) +start_button = tk.Button(app, text="Start.", command=start_button_f, activeforeground="black", background="#17153b", relief="flat", bd="0") -distracted_button = tk.Button(app, text="I got distracted.", command=distracted_button_f) - -complete_task_button = tk.Button(app, text="Complete the task.", command=complete_task_button_f) - -break_button = tk.Button(app, text="Go break :3", command=break_button_f) +distracted_button = tk.Button(app, text="I got distracted.", command=distracted_button_f, fg="red", bg="#17153b", relief="flat", bd="0", activebackground="red", activeforeground="black") +complete_task_button = tk.Button(app, text="Complete the task.", command=complete_task_button_f, fg="aqua", bg="#17153b", relief="flat", bd="0", activebackground="aqua", activeforeground="black") +break_button = tk.Button(app, text="Go break :3", command=break_button_f, fg="orange", bg="#17153b", relief="flat", bd="0", activebackground="orange", activeforeground="black") update_ui() app.mainloop()