Can’t define class in python [closed]

Firstly, your indentation is wrong, you have to place the if on the same indentation level as class, like:

class Library:
   .....

if __name__ == '__main__':
  ....

Secondly, but most importantly, your def __init_() has a typo, it should be __init__() with two underscore trailing and leading init, but you gave just one(trailing).

class Library:
    def __init__(self, root):
        self.root = root
.....

But even after doing all this, you will get another error at Title_Frame.grid(side=TOP), because grid() has not option side, it is the option of pack(), so change that to:

Title_Frame.pack(side=TOP)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top