[Pythonmac-SIG] Crash in MacPython 1.5.2c2 and Tk oddities
Russell E Owen
owen@astro.washington.edu
Tue, 18 Apr 2000 10:51:04 -0700
The following code (simplified from Grayson's "Python and Tkinter")
reliably causes a crash into MacsBug on my 7200 running MacOS 8.6. I
put it in a file and run it by dropping it on PythonInterpter.
Anybody else see this?
Also, as you probably know, Tk fails to exit properly in
PythonInterpter when the quit command is issued or a window is
closed. If I have python execute the quit method of the root window
(which seems to be standard behavior for a quit button) or if I close
the root window by pushing its close control, the interpreter ignores
all requests to quit. and blinks as if it is processing events oddly.
I find I have to do a forced exit.
The workaround for me is to always use cmd-Q or File:Quit to halt the
Tk application, then wait until the interpreter output says the
process has been killed (the Tk windows stay open, but are no longer
active), then issue cmd-Q or File:Quit again to exit the interpreter.
-- Russell
P.S. I am sending this, with the output of StdLog after the crash
directly to Jack Jansen.
---- cut here, save to a file, drop the file onto PythonInterpreter -----
from Tkinter import *
def makeCheckbuttonMenu():
ChkBtn = Menubutton(mBar, text='Checkbutton Menus', underline=0)
ChkBtn.pack(side=LEFT, padx='2m')
ChkBtn.menu = Menu(ChkBtn)
ChkBtn.menu.add_checkbutton(label='Doug')
ChkBtn.menu.add_checkbutton(label='Dinsdale')
ChkBtn.menu.add_checkbutton(label="Stig O'Tracy")
ChkBtn.menu.add_checkbutton(label='Vince')
ChkBtn.menu.add_checkbutton(label='Gloria Pules')
ChkBtn.menu.invoke(ChkBtn.menu.index('Dinsdale'))
ChkBtn['menu'] = ChkBtn.menu
return ChkBtn
root = Tk()
mBar = Frame(root)
mBar.pack()
ChkBtn = makeCheckbuttonMenu()
mBar.tk_menuBar(ChkBtn)
root.title('Menus')
root.mainloop()