Newbie: Tkinter and macPython

gt gtewalt at earthlink.net
Sat Jun 28 22:25:35 EDT 2003


I'm waffling between Ruby, and Python as a programming
language.
I borrowed a friends book on Ruby, and have played with 
it a bit.
I went by the library to check out 'Learning Python'
but i was too late, the library had closed already...

Anyway, to the point.
I downloaded macPython for OSX, and was trying to get
a simpe Tkinter example to work form Lundh's tutorial,
I think it was.
Bu I get an error...

# File: hello1.py

from Tkinter import *

root = Tk()
w = Label(root, text="Hello, world!")
w.pack()

root.mainloop() 


error is:
'Tk' is not defined

and in the IDLE:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/codeop.py",
line 140, in __call__
    codeob = compile(source, filename, symbol, self.flags, 1)
  File "<input>", line 1
     root = Tk()
     ^
 SyntaxError: invalid syntax




More information about the Python-list mailing list