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

Skip to content

Commit e90bfe9

Browse files
committed
handle GetSizeTuple for Phoenix
use wx.Yield instead of WakeUpIdle
1 parent ec06a93 commit e90bfe9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,12 @@ def __init__(self, num, fig):
12711271
self.toolbar.Realize()
12721272
# On Windows platform, default window size is incorrect, so set
12731273
# toolbar width to figure width.
1274-
tw, th = self.toolbar.GetSizeTuple()
1275-
fw, fh = self.canvas.GetSizeTuple()
1274+
if wxc.is_phoenix:
1275+
tw, th = self.toolbar.GetSize()
1276+
fw, fh = self.canvas.GetSize()
1277+
else:
1278+
tw, th = self.toolbar.GetSizeTuple()
1279+
fw, fh = self.canvas.GetSizeTuple()
12761280
# By adding toolbar in sizer, we are able to put it at the bottom
12771281
# of the frame - so appearance is closer to GTK version.
12781282
self.toolbar.SetSize(wx.Size(fw, th))
@@ -1370,9 +1374,10 @@ def show(self):
13701374
def destroy(self, *args):
13711375
DEBUG_MSG("destroy()", 1, self)
13721376
self.frame.Destroy()
1373-
#if self.tb is not None: self.tb.Destroy()
1374-
# wx.GetApp().ProcessIdle()
1375-
wx.WakeUpIdle()
1377+
wxapp = wx.GetApp()
1378+
if wxapp:
1379+
wxapp.Yield()
1380+
13761381

13771382
def get_window_title(self):
13781383
return self.window.GetTitle()

0 commit comments

Comments
 (0)