Closed
Description
Bug report
Bug summary
A check in lib/backends/wx_compat.py (line 156) used to select kwargs arguments for wxPython's AddTool() doesn't correctly identify version "4.0.0" of wxPython as newer than "4.0.0.b2".
Code for reproduction
import matplotlib.pyplot
matplotlib.pyplot.plot([0,1,2])
Actual outcome
File "./external/matplotlib/pyplot.py", line 3250, in plot
File "./external/matplotlib/pyplot.py", line 962, in gca
File "./external/matplotlib/pyplot.py", line 592, in gcf
File "./external/matplotlib/pyplot.py", line 539, in figure
File "./external/matplotlib/backends/backend_wx.py", line 1850, in new_figure_manager
File "./external/matplotlib/backend_bases.py", line 171, in new_figure_manager
File "./external/matplotlib/backends/backend_wx.py", line 1854, in new_figure_manager_given_figure
File "./external/matplotlib/backends/backend_wx.py", line 1192, in __init__
File "./external/matplotlib/backends/backend_wxagg.py", line 25, in _get_toolbar
File "./external/matplotlib/backends/backend_wx.py", line 1503, in __init__
File "./external/matplotlib/backend_bases.py", line 2790, in __init__
File "./external/matplotlib/backends/backend_wx.py", line 1530, in _init_toolbar
File "./external/matplotlib/backends/wx_compat.py", line 174, in _AddTool
TypeError: ToolBar.AddTool(): arguments did not match any overloaded call:
overload 1: argument 1 has unexpected type 'int'
overload 2: 'shortHelpString' is not a valid keyword argument
overload 3: 'shortHelpString' is not a valid keyword argument```
Expected outcome
[<matplotlib.lines.Line2D object at 0x...>]
Changing line 156 of lib/backends/wx_compat.py to the following snippet appears to solve the problem.
if not is_phoenix or LooseVersion(wx.VERSION_STRING) >= str("4.0.0b2") or wx.VERSION_STRING == "4.0.0":
Matplotlib version
- Operating system: Windows 10
- Matplotlib version: 2.1.2
- Matplotlib backend (
print(matplotlib.get_backend())
): WxAGG - Python version: 2.7.14
- Jupyter version (if applicable): N/A
- Other libraries: wxPython 4.0.0