Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01a83de

Browse files
don't store icon as global; re-load instead
1 parent 9844acc commit 01a83de

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,24 +1349,18 @@ def _load_bitmap(filename):
13491349
return bmp
13501350

13511351

1352-
_FRAME_ICON = None
1353-
1354-
13551352
def _set_frame_icon(frame):
13561353
# set frame icon
1357-
global _FRAME_ICON
1358-
if not _FRAME_ICON:
1359-
_FRAME_ICON = bundle = wx.IconBundle()
1360-
for image in ('matplotlib.png', 'matplotlib_large.png'):
1361-
image = os.path.join(matplotlib.rcParams['datapath'], 'images',
1362-
image)
1363-
if not os.path.exists(image):
1364-
continue
1365-
icon = wx.Icon(_load_bitmap(image))
1366-
if not icon.IsOk():
1367-
return
1368-
bundle.AddIcon(icon)
1369-
frame.SetIcons(_FRAME_ICON)
1354+
bundle = wx.IconBundle()
1355+
for image in ('matplotlib.png', 'matplotlib_large.png'):
1356+
image = os.path.join(matplotlib.rcParams['datapath'], 'images', image)
1357+
if not os.path.exists(image):
1358+
continue
1359+
icon = wx.Icon(_load_bitmap(image))
1360+
if not icon.IsOk():
1361+
return
1362+
bundle.AddIcon(icon)
1363+
frame.SetIcons(bundle)
13701364

13711365

13721366
class MenuButtonWx(wx.Button):

0 commit comments

Comments
 (0)