[wxPython] Re: [wxPython-mac] wxPython for OS X - now with menus!

[Replying to a post on wxpython-mac@lists.wxwindows.org]

Kevin & Masako Ollivier wrote:

Hi everyone,

I've (finally!) been able to get menus working on wxPython for Mac OS X. =)
Of course, I did not forget the obligatory screenshot:

http://payson.tulane.edu/kollivier/wxPythonMac-menu.JPG

I tested a number of samples out (including demo.py, hangman.py,
slashdot.py, and wxProject.py) and all the menu code ran fine. There was one
time where there did not appear to be any space between a menu title text
and the shortcut key, but that was the only issue I encountered.

So how did I do it? Actually, all I did was remove a few lines from the
wxWindows/wxMac source code which read in the menubar resource. Here's the
code I removed:

File: src/mac/menu.cpp
in Function wxMenuBar::MacInstallMenuBar

Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
wxString message ;
wxCHECK_RET( menubar != NULL, wxT("can't read MBAR resource"));
::SetMenuBar( menubar ) ;
::DisposeHandle( menubar ) ;

Feel free to try this at home! I'm sure this will cause problems when
creating compiled apps on OS X though. My question is: is there a place we
can "move" the menubar initialization code so that it will get run by
compiled applications, but not by scripted apps? Maybe add an
"InitMenuBar()" function into the IMPLEMENT_APP macro for Mac?

Once we get this code issue resolved, I'm thinking we may want to build an
"alpha" binary version of wxPython for Mac, so that people can play with it
and see what has been done so far. What do you think? A majority of the
other issues I've found in the samples are simply visual "glitches" (like
text alignment and control overlap issues) that should have a more
straight-forward fix for them. =)

Yes, please do provide something to play around with :slight_smile:

             In the meantime, could you post all the changes
             you made to wxMac/wxPython sources and a brief
             procedure for building on OS X?

             BTW, thanks for getting things up and running!

             Manoj

             PS: The tree controls in the screenshots look
             suspiciously like wxGTK. But you are building
             using wxMac, right? Which brings us to the
             possiblity of two wxPythons for OS X: based
             on either wxGTK or wxMac. Do both work now?
             Which one is going to be the "official" one?