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 on "Pathetic Python Sunday"


  1. assuming you have the indenting correct in the real version, you’re missing a space after “def”

    Reply

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.