mac wxpython menubar disappear

  macos, menubar, windows, wxpython

I wrote a wxpython wx.frame with menubar.
The program has run OK in the last two years.
Here is how I created the menubar object.

class CnTaaDMenubar(wx.MenuBar):
def init(self, TaaD, parent):
super(CnTaaDMenubar, self).init()
self.__TaaD = TaaD
self.parent = parent

      #--- cretate the file menu
      fileMenu = wx.Menu()
      saveItem = wx.MenuItem(fileMenu, wx.ID_SAVE,text = "save log",kind = wx.ITEM_NORMAL)
      # copyItem.SetBitmap(wx.Bitmap("copy.bmp")) 
      fileMenu.Append(saveItem) 

      saveAsItem = wx.MenuItem(fileMenu, wx.ID_SAVEAS, text = "save log as ...",kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      fileMenu.Append(saveAsItem) 

      importTestScriptItem = wx.MenuItem(fileMenu, wx.NewId(), text = "I&import script",kind = wx.ITEM_NORMAL)
      # copyItem.SetBitmap(wx.Bitmap("copy.bmp")) 
      fileMenu.Append(importTestScriptItem) 


      quitItem = wx.MenuItem(fileMenu, wx.ID_CLOSE, text = "quit",kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      fileMenu.Append(quitItem) 

      self.Append(fileMenu, '&file') 

      #--- create the edit menu 
      editMenu = wx.Menu() 
      copyItem = wx.MenuItem(editMenu, wx.ID_COPY,text = "copy",kind = wx.ITEM_NORMAL)
      # copyItem.SetBitmap(wx.Bitmap("copy.bmp")) 
      editMenu.Append(copyItem) 

      cutItem = wx.MenuItem(editMenu, wx.ID_CUT,text = "cut",kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      editMenu.Append(cutItem) 

      pasteItem = wx.MenuItem(editMenu, wx.ID_PASTE,text = "paste",kind = wx.ITEM_NORMAL) 
      # pasteItem.SetBitmap(wx.Bitmap("paste.bmp")) 
      editMenu.Append(pasteItem)

      self.Append(editMenu, '&edit') 

      #--- create view item
      viewMenu = wx.Menu() 
      animaOrScreenShotItem = wx.MenuItem(viewMenu, wx.NewId(),text = "change to animation",kind = wx.ITEM_CHECK) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      viewMenu.Append(animaOrScreenShotItem) 
      self.Append(viewMenu, '&view') 

      ####################################################
      # project menu
      projectMenu = wx.Menu() 

      switchProjectItem = wx.MenuItem(projectMenu, wx.NewId(), text = "switch project",kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      projectMenu.Append(switchProjectItem) 

      updateProjectItem = wx.MenuItem(projectMenu, wx.NewId(), text = "update project",kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      projectMenu.Append(updateProjectItem) 

      newProjectItem = wx.MenuItem(projectMenu, wx.NewId(), text = "new project",kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      projectMenu.Append(newProjectItem) 

      inviteItem = wx.MenuItem(projectMenu, wx.NewId(), text = "invite member", kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      projectMenu.Append(inviteItem) 

      addIssueTrackerItem = wx.MenuItem(projectMenu, wx.NewId(), text = "add issue tracker", kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      projectMenu.Append(addIssueTrackerItem) 

      deleteIssueTrackerItem = wx.MenuItem(projectMenu, wx.NewId(), text = "delete issue tracker", kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      projectMenu.Append(deleteIssueTrackerItem) 

      self.Append(projectMenu, '&project') 


      ####################################################
      # test data menu
      testDataMenu = wx.Menu() 
      newTestDataItem = wx.MenuItem(testDataMenu, wx.NewId(), text = "new test data card",kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      testDataMenu.Append(newTestDataItem) 
    
      selectTestDataItem = wx.MenuItem(testDataMenu, wx.NewId(), text = "select test data card",kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      testDataMenu.Append(selectTestDataItem) 

      updateTestDataItem = wx.MenuItem(testDataMenu, wx.NewId(), text = "update test data card",kind = wx.ITEM_NORMAL) 
      # cutItem.SetBitmap(wx.Bitmap("cut.bmp")) 
      testDataMenu.Append(updateTestDataItem) 
      self.Append(testDataMenu, '&test data') 

      #--- cretate the file menu
      TRGMenu = wx.Menu()
      newTRGItem = wx.MenuItem(TRGMenu, wx.NewId(), text = "register TRG", kind = wx.ITEM_NORMAL)
      # copyItem.SetBitmap(wx.Bitmap("copy.bmp")) 
      TRGMenu.Append(newTRGItem) 

      myTRGsItem = wx.MenuItem(TRGMenu, wx.NewId(), text = "my TRGs", kind = wx.ITEM_NORMAL)
      # copyItem.SetBitmap(wx.Bitmap("copy.bmp")) 
      TRGMenu.Append(myTRGsItem) 

      updateTRGItem = wx.MenuItem(TRGMenu, wx.NewId(), text = "update TRG", kind = wx.ITEM_NORMAL)
      # copyItem.SetBitmap(wx.Bitmap("copy.bmp")) 
      TRGMenu.Append(updateTRGItem) 

      self.Append(TRGMenu, '&TRGs')


      ####################################################
      # help in menubar 
      helpMenu = wx.Menu() 
      menuHtmlItem = wx.MenuItem(helpMenu, wx.NewId(), "help", kind=wx.ITEM_NORMAL)
      helpMenu.Append(menuHtmlItem) 
      aboutUsItem = wx.MenuItem(helpMenu, wx.NewId(), "about us", kind=wx.ITEM_NORMAL)
      helpMenu.Append(aboutUsItem) 

      self.Append(helpMenu, '&help') 

      self.Bind(wx.EVT_MENU, self.onQuit, quitItem)
      self.Bind(wx.EVT_MENU, self.onSwitchProject, switchProjectItem)
      self.Bind(wx.EVT_MENU, self.onUpdateProject, updateProjectItem) 
      self.Bind(wx.EVT_MENU, self.onNewProject, newProjectItem) 

      self.Bind(wx.EVT_MENU, self.addIssueTracker, addIssueTrackerItem) 
      self.Bind(wx.EVT_MENU, baseFrame.onNull, deleteIssueTrackerItem)

      self.Bind(wx.EVT_MENU, self.__TaaD.queryDataCardManager().createTestData, newTestDataItem)
      self.Bind(wx.EVT_MENU, self.__TaaD.queryDataCardManager().selectTestData, selectTestDataItem)
      self.Bind(wx.EVT_MENU, baseFrame.onNull, updateTestDataItem)

      self.Bind(wx.EVT_MENU, self.onNewTRG, newTRGItem)
      self.Bind(wx.EVT_MENU, self.onMyTRGs, myTRGsItem)
      self.Bind(wx.EVT_MENU, self.onUpdateTRG, updateTRGItem)

      self.Bind(wx.EVT_CLOSE, self.onTerminate)enter code here

Here is how I invoke this menubar in the wx.frame instantiation method.

    self.menubar = CnTaaDMenubar(self.__TaaD, self)
    self.SetMenuBar(self.menubar)
    self.menubar.Show() 

But today suddenly the menubar disappears in the mac platform while it still appears in the windows platform.
I checked the wx.frame style and explicitly add the wx.SYSTEM_MENU option and explicitly add the menubar.Show() statement here and there.
But the problem has not been solved in the mac platform.
Can someone help me ?

Thanks

Farn

Source: Windows Questions

LEAVE A COMMENT