Hi all,
Testing FloatCanvas on OS-X, I've noticed an issue with toolbars. I can't seem to place regular old buttons on a toolbar anymore.
I notices this notice under 2.7.1.1 Recent Changes:
"""
wxMac: I've turned on the compile option for using the native toolbar on the Mac now that it supports hosting of controls. If the toolbar is managed by the frame via either CreateToolBar() or SetToolBar() then the native toolbar will be used. Additional toolbars, or toolbars that are not children of the frame, are managed by sizers or what-not will still use the emulated toolbar because of platform restrictions in how/where the native toolbar can be used.
"""
In this case, I've got the toolbar manged by a sizer, so it should be using the old emulated toolbar, but it's not working right. I'll poke into this more, but just in case someone has a brilliant suggestion, here's a bit of the code:
def BuildToolbar(self):
tb = wx.ToolBar(self)
self.ToolBar = tb
tb.SetToolBitmapSize((24,24))
self.PointerTool = tb.AddRadioTool(wx.ID_ANY,
bitmap=Resources.getPointerBitmap(),
shortHelp = "Pointer")
self.Bind(wx.EVT_TOOL,
lambda evt : self.SetMode(Mode=self.GUIMouse),
self.PointerTool)
self.ZoomInTool = tb.AddRadioTool(wx.ID_ANY,
bitmap=Resources.getMagPlusBitmap(),
shortHelp = "Zoom In")
self.Bind(wx.EVT_TOOL,
lambda evt : self.SetMode(Mode=self.GUIZoomIn),
self.ZoomInTool)
self.ZoomOutTool = tb.AddRadioTool(wx.ID_ANY,
bitmap=Resources.getMagMinusBitmap(),
shortHelp = "Zoom Out")
self.Bind(wx.EVT_TOOL,
lambda evt : self.SetMode(Mode=self.GUIZoomOut),
self.ZoomOutTool)
self.MoveTool = tb.AddRadioTool(wx.ID_ANY,
bitmap=Resources.getHandBitmap(),
shortHelp = "Move")
self.Bind(wx.EVT_TOOL,
lambda evt : self.SetMode(Mode=self.GUIMove),
self.MoveTool)
tb.AddSeparator()
self.ZoomButton = wx.Button(tb, label="Zoom To Fit")
tb.AddControl(self.ZoomButton)
self.ZoomButton.Bind(wx.EVT_BUTTON, self.ZoomToFit)
tb.Realize()
return tb
The "ZoomButton" never gets rendered. Is there something I should be doing differently?
By the way, there are also some oddities in the toolbar used by matplotlib.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception