Skip to content

Commit

Permalink
Fix timing issue in delay check
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brianzhouzc authored and gnikit committed Nov 17, 2024
1 parent 51ee214 commit 3d8620d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tktooltip/tooltip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3d8620d

Please sign in to comment.