Files
Focus_timer/main.py
2026-05-17 00:59:35 +03:00

42 lines
1.0 KiB
Python

import tkinter as tk
import time
width = 120
height = 140
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.resizable(False, False)
app.update_idletasks()
text_label = tk.Label(app, text="Wanna start?", fg="#C8ACD6", background="#17153B",font=("Helvetica", 14), anchor="center")
text_label.pack(side="top",pady="15")
time_label = tk.Label(app, text="hh:mm:ss",fg="#C8ACD6",background="#17153B",font=("Helvetica", 25) , anchor="center")
time_label.pack(expand=True,fill="y")
seconds = 1200
def start():
global seconds
text_label.config(text="Time to focus!")
time_label.config(fg="#AE445A")
if seconds > 0:
mins, secs = divmod(seconds, 60)
time_label.config(text=f"{mins}:{secs}")
app.after(1000, start)
seconds -= 1
start_button = tk.Button(app, text="start", command=start, fg="#C8ACD6", background="#17153B")
start_button.pack(side="bottom", pady="15")
app.mainloop()