Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,8 +1271,12 @@ def __init__(self, num, fig):
self.toolbar.Realize()
# On Windows platform, default window size is incorrect, so set
# toolbar width to figure width.
tw, th = self.toolbar.GetSizeTuple()
fw, fh = self.canvas.GetSizeTuple()
if wxc.is_phoenix:
tw, th = self.toolbar.GetSize()
fw, fh = self.canvas.GetSize()
else:
tw, th = self.toolbar.GetSizeTuple()
fw, fh = self.canvas.GetSizeTuple()
# By adding toolbar in sizer, we are able to put it at the bottom
# of the frame - so appearance is closer to GTK version.
self.toolbar.SetSize(wx.Size(fw, th))
Expand Down Expand Up @@ -1370,9 +1374,9 @@ def show(self):
def destroy(self, *args):
DEBUG_MSG("destroy()", 1, self)
self.frame.Destroy()
#if self.tb is not None: self.tb.Destroy()
# wx.GetApp().ProcessIdle()
wx.WakeUpIdle()
wxapp = wx.GetApp()
if wxapp:
wxapp.Yield()

def get_window_title(self):
return self.window.GetTitle()
Expand Down Expand Up @@ -1457,8 +1461,12 @@ def Destroy(self):

def _onMenuButton(self, evt):
"""Handle menu button pressed."""
x, y = self.GetPositionTuple()
w, h = self.GetSizeTuple()
if wxc.is_phoenix:
x, y = self.GetPosition()
w, h = self.GetSize()
else:
x, y = self.GetPositionTuple()
w, h = self.GetSizeTuple()
self.PopupMenuXY(self._menu, x, y + h - 4)
# When menu returned, indicate selection in button
evt.Skip()
Expand Down Expand Up @@ -1779,7 +1787,10 @@ def OnPrintPage(self, page):
(ppw, pph) = self.GetPPIPrinter() # printer's pixels per in
(pgw, pgh) = self.GetPageSizePixels() # page size in pixels
(dcw, dch) = dc.GetSize()
(grw, grh) = self.canvas.GetSizeTuple()
if wxc.is_phoenix:
(grw, grh) = self.canvas.GetSize()
else:
(grw, grh) = self.canvas.GetSizeTuple()

# save current figure dpi resolution and bg color,
# so that we can temporarily set them to the dpi of
Expand Down
3 changes: 3 additions & 0 deletions lib/matplotlib/backends/backend_wxagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import wx


show = backend_wx.Show()


class FigureFrameWxAgg(FigureFrameWx):
def get_canvas(self, fig):
return FigureCanvasWxAgg(self, -1, fig)
Expand Down