Sunday, April 01, 2007

Pathetic Python Sunday

What on earth is causing this class definition to throw a syntax error? The error occurs at the colon (yup, the one that has to be there according to docs.python.org) in the second line.

class gui:
def_init_(self, mainwindow):
self.frame1 = Frame.mainwindow
self.frame1.pack()


Update: Thanks. Yes, the code is correctly indented elsewhere. Now, I'm getting a TypeError "This constructor takes no arguments". Eh?

Update again: OK, typeerror gone. But now getting a syntax error at every reference to the constructor's (self) method. Eh?

2 comments:

Anonymous said...

assuming you have the indenting correct in the real version, you're missing a space after "def"

Anonymous said...

Could you put the whole thing into a text file. Or email it to me? daveweeden@mac.com

kostenloser Counter