From c267155b257d37a783ae292ae29ea89bd995d7dd Mon Sep 17 00:00:00 2001 From: Angoosh Leviocki Date: Wed, 27 Nov 2024 16:18:09 +0100 Subject: [PATCH] modified timer so it counts to -10s --- SW/PC/Stopwatch/main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SW/PC/Stopwatch/main.py b/SW/PC/Stopwatch/main.py index a140f6b..8248046 100644 --- a/SW/PC/Stopwatch/main.py +++ b/SW/PC/Stopwatch/main.py @@ -6,7 +6,7 @@ gi.require_version('Gtk', '4.0') from gi.repository import Gtk, Gio, Gdk index = 2 -TIME = 10*60 +TIME = 10 class GridRow(): def __init__(self, parent, runner, index): @@ -41,9 +41,13 @@ class GridRow(): def updateTime(self): t = TIME - while t: - mins, secs = divmod(t, 60) - timer = '{:02d}:{:02d}'.format(mins, secs) + while t >= -10: + if t < 0: + mins, secs = divmod((t * -1), 60) + timer = '-{:02d}:{:02d}'.format(mins, secs) + else: + mins, secs = divmod(t, 60) + timer = '{:02d}:{:02d}'.format(mins, secs) self.runb.set_label(timer) time.sleep(1) t -= 1