-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Description
wx assertion error when starting canvas timer instance.
Code for reproduction
import matplotlib
matplotlib.use('WXAgg')
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
def update_title(axes):
axes.set_title(datetime.now())
axes.figure.canvas.draw()
fig, ax = plt.subplots()
x = np.linspace(-3, 3)
ax.plot(x, x ** 2)
timer = fig.canvas.new_timer(interval=100)
timer.add_callback(update_title, ax)
timer.start()
plt.show()
Actual outcome
Traceback (most recent call last):
File "timer_debug.py", line 18, in <module>
timer = fig.canvas.new_timer(interval=100)
File "/Users/ewthornton/opt/anaconda3/envs/grid_gen3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2374, in new_timer
return self._timer_cls(interval=interval, callbacks=callbacks)
File "/Users/ewthornton/opt/anaconda3/envs/grid_gen3/lib/python3.7/site-packages/matplotlib/backends/backend_wx.py", line 78, in __init__
TimerBase.__init__(self, *args, **kwargs)
File "/Users/ewthornton/opt/anaconda3/envs/grid_gen3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 1094, in __init__
self.single_shot = False
File "/Users/ewthornton/opt/anaconda3/envs/grid_gen3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 1145, in single_shot
self._timer_set_single_shot()
File "/Users/ewthornton/opt/anaconda3/envs/grid_gen3/lib/python3.7/site-packages/matplotlib/backends/backend_wx.py", line 91, in _timer_set_single_shot
self._timer.Start()
wx._core.wxAssertionError: C++ assertion "m_milli > 0" failed at /opt/concourse/worker/volumes/live/3ef8f33f-8e5b-442f-6716-948fc4646a36/volume/wxpython_1547931203930/work/ext/wxWidgets/src/osx/core/timer.cpp(69) in Start(): invalid value for timer timeout
Expected outcome
Should produce output like this example.
https://matplotlib.org/3.1.1/gallery/event_handling/timers.html
Matplotlib version
- Operating system: OSX 10.15.6
- Matplotlib version: 3.3.2 (bug not present in 3.2.2)
- Matplotlib backend (
print(matplotlib.get_backend())
): wxAgg - Python version: 3.7.8
- Jupyter version (if applicable):
- Other libraries: wxpython 4.0.4 (also tried 4.0.7-post2)
conda
Conda-forge