MCPcopy Create free account
hub / github.com/geekcomputers/Python / count_down

Function count_down

Pomodoro (tkinter).py:111–134  ·  view source on GitHub ↗
(count)

Source from the content-addressed store, hash-verified

109
110
111def count_down(count):
112 global timer_mec, remaining_time
113 remaining_time = count
114 minutes = count // 60
115 seconds = count % 60
116 if seconds < 10:
117 seconds = f"0{seconds}"
118 canvas.itemconfig(timer_text, text=f"{minutes}:{seconds}")
119
120 if total_time > 0:
121 progress = (total_time - count) / total_time
122 canvas.itemconfig(progress_arc, extent=progress * 360)
123
124 if count > 0 and not is_paused:
125 timer_mec = window.after(1000, count_down, count - 1)
126 elif count == 0:
127 if ROUND % 2 == 1:
128 show_notification("Work session complete! Time for a break.")
129 else:
130 show_notification("Break over! Back to work.")
131 if ROUND % 2 == 0:
132 tick_label.config(text=tick_label.cget("text") + "#")
133 ROUND += 1
134 start_timer()
135
136
137def pause_timer():

Callers 2

start_timerFunction · 0.85
resume_timerFunction · 0.85

Calls 2

show_notificationFunction · 0.85
start_timerFunction · 0.85

Tested by

no test coverage detected