[Pythonmac-SIG] "A GUI Test Session" from Learning Python Crashes

Jack Jansen jack@oratrix.nl
Mon, 04 Oct 1999 15:21:33 +0200


> This is not too surprising.  The IDE has its own menu bar.  Tk has 
> its own menu bar.  When you run a Tk program from within the IDE, 
> Tk's menu bar clobbers that of the IDE.  When the Tk program quits, 
> there is no longer a valid menu bar, and the Mac goes off in search 
> of one and never comes back.  ;)  (Actually, it probably just shoots 
> itself.)

This is fixable, I did it for twit (the now-retired debugger of which some 
ideas have survived in IDE). Just keep two menu bars around, one to be 
installed when the user program runs and one for when IDE runs. IDE knows when 
it goes to user code (and when it comes back) so it can swap them at the right 
moment:
        def switch_to_app(self):
                self.dbg_menu_bar = Menu.GetMenuBar()
                Menu.SetMenuBar(self.app_menu_bar)
                Menu.DrawMenuBar()
                
        def switch_to_dbg(self):
                self.app_menu_bar = Menu.GetMenuBar()
                Menu.SetMenuBar(self.dbg_menu_bar)
                Menu.DrawMenuBar()

Now, if an application (like a Tkinter app) messes with the menu bar that 
shouldn't influence operation of IDE.

If anyone puts such code into the IDE please report back,
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm