[Tutor] Tkinter crash help please.

SA sarmstrong13@mac.com
Fri, 07 Jun 2002 13:10:56 -0500


Hi Everyone-

    I've installed python, tcl, tk on my MacOSX 10.1.5 system using the
--enable-frameworks configuration. I have a framework for tcl,tk,and python
under my /Library/Frameworks directory. When I run a simple button code in a
python script:

#!/usr/bin/env python

import sys
from Tkinter import *

def die(event):
    sys.exit()

root = Tk()
button = Button(root)
button["text"] = "Hello"
button.bind("<Button-1>", die)
button.pack()
root.mainloop()

I get the following output in my shell(tcsh by the way):

original argc=2
original argv[0] = "python"
original argv[1] = "./ave.py"
modified argc=2
modified argv[0] = "python"
modified argv[1] = "./ave.py"

Nothing happens.

So I then hit Ctrl-C to stop the script and I get the following Traceback
error:

Traceback (most recent call last):
  File "./ave.py", line 14, in ?
    root.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

It looks like it is calling the correct Tkinter Module, but nothing is bein
displayed. If however I enter the code line for line in the Python.app that
I compile, I get the proper button widget. Maybe I'm wrong (because I
definitely do NOT fully understand the Mac OSX Frameworks system yet), but
if the coded is properly calling the correct Tkinter module, it should not
matter whether or not it is done within the Python.app or by calling python
from within Python.app. Is this correct? Is there a way to do this on a Mac?
(other than MacPython wich works only on pre OSX systems and doe not take
advantage of the BSD under OSX)

Thanks.
SA