close

[Solved] TypeError: object.__init__() takes exactly one argument (the instance to initialize)

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error TypeError: object.init() takes exactly one argument (the instance to initialize) in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How TypeError: object.init() takes exactly one argument (the instance to initialize) Error Occurs?

Today I get the following error TypeError: object.init() takes exactly one argument (the instance to initialize) in python.

How To Solve TypeError: object.init() takes exactly one argument (the instance to initialize) Error ?

  1. How To Solve TypeError: object.init() takes exactly one argument (the instance to initialize) Error ?

    To Solve TypeError: object.init() takes exactly one argument (the instance to initialize) Error OK, so the error is actually not in your super(Grid1,self).__init__(**kwargs) statement, it's in the creation of the Submit button.

  2. TypeError: object.init() takes exactly one argument (the instance to initialize)

    To Solve TypeError: object.init() takes exactly one argument (the instance to initialize) Error OK, so the error is actually not in your super(Grid1,self).__init__(**kwargs) statement, it's in the creation of the Submit button.

Solution 1

OK, so the error is actually not in your super(Grid1,self).__init__(**kwargs) statement, it’s in the creation of the Submit button. You did:

self.submit = Button(text="Submit", font=40)
self.add_widget(self.submit)

But as the docs say, the font size is set by font_size and not font. The code should be:

self.submit = Button(text="Submit", font_size=40)
self.add_widget(self.submit)

This should work just fine.

Edit

Note that the issue, then, is that font, not being recognized by Button (or anyone else), is simply passed on up the chain until it is ultimately passed to object.__init__ (which raises an error instead of simply ignoring unexpected arguments).

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read