Below is a slightly simplified extract from the VPython library that creates a window into which a 3D OpenGL canvas can be inserted, along with widgets such as buttons and sliders (_plat is “Windows” or “Macintosh” or “Unix”). The attributes self.panel and self.menubar are referenced by the user’s program to set up widgets. I find experimentally that on Linux “self.win.Show(True)” must precede the panel and menubar setups, whereas on a Mac “self.win.Show(True)” must follow the panel and menubar setups, and on Windows it can either precede or follow. I don’t have a mental model of how these things work together. Can someone comment on these platform differences? Are these differences likely to be the same with future changes in wxPython? Thanks.
self.win = _wx.Frame(None, -1, title, pos=(x, y),
size=(width, height), style=_wx.DEFAULT_FRAME_STYLE)
self.win.Bind(_wx.EVT_CLOSE, self._OnExitApp)
self.win.Bind(_wx.EVT_MOVE, self._OnMove)
self.win.Bind(_wx.EVT_SIZE, self._OnSize)
if _plat != ‘Macintosh’: self.win.Show(True)
self.panel = _wx.Panel(self.win)
self.menubar = _wx.MenuBar()
menu = _wx.Menu()
item = menu.Append(_wx.ID_EXIT, “E&xit\tCtrl-Q”, “Exit demo”)
self.win.Bind(_wx.EVT_MENU, self._OnExitApp, item)
self.menubar.Append(menu, “&File”)
self.win.SetMenuBar(self.menubar)
if _plat == ‘Macintosh’: self.win.Show(True)
return