Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

Commit

Permalink
Update focus-timer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
a-blob committed Aug 22, 2023
1 parent 194343b commit 2139014
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions focus-timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@ def break_window(breaktime):
label = tk.Label(breakwindow, text = "It's time to take a break!", font = ("Times New Roman", 36), bg = '#FFFBE4')
label.place(relx = 0.5, rely = 0.5, anchor = "center")

breakwindow.after(breaktime, breakwindow.destroy)
breakwindow.after(breaktime, lambda: on_close(breakwindow))

def on_close(window):
window.destroy()
on_ok(focusentry, breakentry, breaktime)


def on_ok(focusentry, breakentry, breaktime):
focustime = (focusentry.get())
breaktime = (breakentry.get())
breaktime = int(breaktime)
breaktime = breaktime * 1000
breaktime = breaktime * 60000
focus_countdown(focustime, breaktime)


def focus_countdown(count, breaktime):
count = int(count)
print(count)
if count > 0:
count_label.config(text=str(count))
inputwindow.after(1000, focus_countdown, count - 1, breaktime)
inputwindow.after(60000, focus_countdown, count - 1, breaktime)
else:
break_window(breaktime)

Expand Down

0 comments on commit 2139014

Please sign in to comment.