Skip to content

Commit 87bfe62

Browse files
committed
FIX: Add single shot update capability to TimerWx
1 parent b98b898 commit 87bfe62

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ def _timer_set_interval(self):
6969
if self._timer.IsRunning():
7070
self._timer_start() # Restart with new interval.
7171

72+
def _timer_set_single_shot(self):
73+
if self._timer.IsRunning():
74+
self._timer_start() # Restart with new interval.
75+
7276

7377
@_api.deprecated(
7478
"2.0", name="wx", obj_type="backend", removal="the future",

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,8 @@ def _impl_test_interactive_timers():
653653
assert mock_repeating.call_count > expected_100ms_calls, \
654654
f"Expected more than {expected_100ms_calls} calls, " \
655655
f"got {mock_repeating.call_count}"
656-
assert mock_single_shot.call_count == 1
656+
assert mock_single_shot.call_count == 1, \
657+
f"Expected 1 call, got {mock_single_shot.call_count}"
657658

658659
# Test updating the interval updates a running timer
659660
timer_repeating.interval = 100
@@ -666,7 +667,8 @@ def _impl_test_interactive_timers():
666667
assert 1 < mock_repeating.call_count <= expected_100ms_calls + 1, \
667668
f"Expected less than {expected_100ms_calls + 1} calls, " \
668669
"got {mock.call_count}"
669-
assert mock_single_shot.call_count == 2
670+
assert mock_single_shot.call_count == 2, \
671+
f"Expected 2 calls, got {mock_single_shot.call_count}"
670672
plt.close("all")
671673

672674

0 commit comments

Comments
 (0)