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

Skip to content

Commit 4884115

Browse files
committed
Merge pull request #4479 from wernerfb/PhoenixMay2015
Problems with mpl.pyplot
2 parents 420f7c9 + 3523f9e commit 4884115

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 19 additions & 8 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,9 @@ 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()
13761380

13771381
def get_window_title(self):
13781382
return self.window.GetTitle()
@@ -1457,8 +1461,12 @@ def Destroy(self):
14571461

14581462
def _onMenuButton(self, evt):
14591463
"""Handle menu button pressed."""
1460-
x, y = self.GetPositionTuple()
1461-
w, h = self.GetSizeTuple()
1464+
if wxc.is_phoenix:
1465+
x, y = self.GetPosition()
1466+
w, h = self.GetSize()
1467+
else:
1468+
x, y = self.GetPositionTuple()
1469+
w, h = self.GetSizeTuple()
14621470
self.PopupMenuXY(self._menu, x, y + h - 4)
14631471
# When menu returned, indicate selection in button
14641472
evt.Skip()
@@ -1779,7 +1787,10 @@ def OnPrintPage(self, page):
17791787
(ppw, pph) = self.GetPPIPrinter() # printer's pixels per in
17801788
(pgw, pgh) = self.GetPageSizePixels() # page size in pixels
17811789
(dcw, dch) = dc.GetSize()
1782-
(grw, grh) = self.canvas.GetSizeTuple()
1790+
if wxc.is_phoenix:
1791+
(grw, grh) = self.canvas.GetSize()
1792+
else:
1793+
(grw, grh) = self.canvas.GetSizeTuple()
17831794

17841795
# save current figure dpi resolution and bg color,
17851796
# so that we can temporarily set them to the dpi of

lib/matplotlib/backends/backend_wxagg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import wx
1717

1818

19+
show = backend_wx.Show()
20+
21+
1922
class FigureFrameWxAgg(FigureFrameWx):
2023
def get_canvas(self, fig):
2124
return FigureCanvasWxAgg(self, -1, fig)

0 commit comments

Comments
 (0)