From 3d8620d2f115db6bd6ed0d5209283d66cae04077 Mon Sep 17 00:00:00 2001 From: brianzhouzc Date: Tue, 5 Nov 2024 13:07:27 -0800 Subject: [PATCH] Fix timing issue in delay check Changed the condition from `>` to `>=` in the time check `time.time() - self.last_moved > self.delay`. This resolves an issue where the check could fail on Windows due to `time.time()` having a 16ms accuracy, potentially causing `time.time() - self.last_moved` to be 0. This ensures the delay condition works correctly even if `self.delay` is 0. --- tktooltip/tooltip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tktooltip/tooltip.py b/tktooltip/tooltip.py index f79f712..37c1fad 100644 --- a/tktooltip/tooltip.py +++ b/tktooltip/tooltip.py @@ -177,7 +177,7 @@ def _show(self) -> None: """ if ( self.status == ToolTipStatus.INSIDE - and time.time() - self.last_moved > self.delay + and time.time() - self.last_moved >= self.delay ): self.status = ToolTipStatus.VISIBLE