Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Make wx and wxagg work with wx 2.9.x on Mac. #1994

Closed
wants to merge 1 commit into from

1 participant

@efiring
Owner

This affects the wx* backends on OSX only. It removes Mac-specific
code that was letting the Frame manage the toolbar directly, without
using the Sizer. There was a comment saying that this was needed
for OSX 10.3. With wx 2.9.x, however, this method of handling
the toolbar does not work at all; no toolbar appears, and the
program can hang or otherwise behave erratically. The Sizer
method, however, works.

The big question is whether the Sizer method works on the Mac
with wx 2.8.x. If it does, then this can be merged.

@efiring efiring Make wx and wxagg work with wx 2.9.x on Mac.
This affects the wx* backends on OSX only.  It removes Mac-specific
code that was letting the Frame manage the toolbar directly, without
using the Sizer.  There was a comment saying that this was needed
for OSX 10.3.  With wx 2.9.x, however, this method of handling
the toolbar does not work at all; no toolbar appears, and the
program can hang or otherwise behave erratically.  The Sizer
method, however, works.

The big question is whether the Sizer method works on the Mac
with wx 2.8.x.  If it does, then this can be merged.
b896df5
@efiring
Owner

@pelson, @dmcdougall, I think both of you have Macs. Do either of you have wx 2.8 installed? If so, would you please test this? I have only 2.9.4 cocoa. You should also be able to test the equivalent of this by running embedding_in_wx5.py, which is using the same method of placing the toolbar.

There is still a glitch with 2.9.4 in the drawing of the zoom rectangle; it's ugly, but one can live with it.

@efiring efiring referenced this pull request
Closed

- wxPython Phoenix #1995

@efiring
Owner

It looks like I pushed the wrong branch. I am closing this and have opened #2004.

@efiring efiring closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 13, 2013
  1. @efiring

    Make wx and wxagg work with wx 2.9.x on Mac.

    efiring authored
    This affects the wx* backends on OSX only.  It removes Mac-specific
    code that was letting the Frame manage the toolbar directly, without
    using the Sizer.  There was a comment saying that this was needed
    for OSX 10.3.  With wx 2.9.x, however, this method of handling
    the toolbar does not work at all; no toolbar appears, and the
    program can hang or otherwise behave erratically.  The Sizer
    method, however, works.
    
    The big question is whether the Sizer method works on the Mac
    with wx 2.8.x.  If it does, then this can be merged.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 17 deletions.
  1. +8 −17 lib/matplotlib/backends/backend_wx.py
View
25 lib/matplotlib/backends/backend_wx.py
@@ -1495,28 +1495,19 @@ def __init__(self, num, fig):
self.canvas.SetFocus()
self.sizer =wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
- # 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 = self._get_toolbar(statbar)
if self.toolbar is not None:
self.toolbar.Realize()
- if wx.Platform == '__WXMAC__':
- # Mac platform (OSX 10.3, MacPython) does not seem to cope with
- # having a toolbar in a sizer. This work-around gets the buttons
- # back, but at the expense of having the toolbar at the top
- self.SetToolBar(self.toolbar)
- else:
- # 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()
- # By adding toolbar in sizer, we are able to put it at the bottom
- # of the frame - so appearance is closer to GTK version.
- # As noted above, doesn't work for Mac.
- self.toolbar.SetSize(wx.Size(fw, th))
- self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
+ # 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()
+ # 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))
+ self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
self.SetSizer(self.sizer)
self.Fit()
Something went wrong with that request. Please try again.