[Tutor] Tkinter help.

SA sarmstrong13@mac.com
Sun, 14 Jul 2002 17:09:01 -0500


I have the following python test script:

import Tkinter
from Tkconstants import *
tk = Tkinter.Tk()
frame = Tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
label = Tkinter.Label(frame, text="Hello, World")
label.pack(fill=X, expand=1)
button = Tkinter.Button(frame,text="Exit",command=tk.destroy)
button.pack(side=BOTTOM)
tk.mainloop()

When I run it on my Mac using the Python and Tcl frameworks for MacOSX I get
the correct widget to show up, but when I click the "Exit" button freaky
stuff begins to happen. From the command line interpreter I get:

SetFrontProcess failed,-600
SetFrontProcess failed,-600
SetFrontProcess failed,-600
SetFrontProcess failed,-600
SetFrontProcess failed,-600
SetFrontProcess failed,-600

I then hit ctrl-C to interrupt and get the following:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "tktest.py", line 11, in ?
    tk.mainloop()
  File 
"/Library/Frameworks/Python.framework/Versions/2.2/lib/python2.2/lib-tk/Tkin
ter.py", line 929, in mainloop
    self.tk.mainloop(n)
KeyboardInterrupt

Now if I turn on Xdarwin and run this same program in X on the same system
using the default Python and Tcl libraries for X, everything runs OK. So I
have to assume something is wrong with the Tcl/Tk frameworks for MacOSX.

Anyone have a clue what the problem is?

Thanks.
SA