8000 Fix wx_compat code for wxPython >= 4.0.0b2 · matplotlib/matplotlib@a83a102 · GitHub
[go: up one dir, main page]

Skip to content

Commit a83a102

Browse files
committed
Fix wx_compat code for wxPython >= 4.0.0b2
1 parent fdb414f commit a83a102

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

lib/matplotlib/backends/wx_compat.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,23 @@ def _AddTool(parent, wx_ids, text, bmp, tooltip_text):
145145
kind = wx.ITEM_CHECK
146146
else:
147147
kind = wx.ITEM_NORMAL
148-
parent.AddTool(wx_ids[text], label=text,
149-
bitmap=bmp,
150-
bmpDisabled=wx.NullBitmap,
151-
shortHelpString=text,
152-
longHelpString=tooltip_text,
153-
kind=kind)
148+
149+
if LooseVersion(wx.VERSION_STRING) >= LooseVersion("4.0.0b2"):
150+
kwargs = dict(label=text,
151+
bitmap=bmp,
152+
bmpDisabled=wx.NullBitmap,
153+
shortHelp=text,
154+
longHelp=tooltip_text,
155+
kind=kind)
156+
else:
157+
kwargs = dict(label=text,
158+
bitmap=bmp,
159+
bmpDisabled=wx.NullBitmap,
160+
shortHelpString=text,
161+
longHelpString=tooltip_text,
162+
kind=kind)
163+
164+
parent.AddTool(wx_ids[text], **kwargs)
154165
else:
155166
if text in ['Pan', 'Zoom']:
156167
parent.AddCheckTool(

0 commit comments

Comments
 (0)
0