Reputation: 53
The code of this exercise app goes like this, i've compared it to the code of the example video and it was exactly the same. What it could be the problem?
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
class MyGrid(GridLayout):
def __init__(self, **kwargs):
super(MyGrid, self).__init__(**kwargs)
self.cols = 2
self.add_widget(Label(text="Name: "))
self.name = TextInput(multilane=False)
self.add_widget(self.name)
class MyApp(App):
def build(self):
return MyGrid()
if __name__ == "__main__":
MyApp().run()
But it throws me this error:
TypeError: object.__init__() takes exactly one argument (the instance to initialize)
Refering to:
File "C:/Users/JLHI6/AppData/Local/Programs/Python/Python38-32/Scripts/Prueba Kivy.py", line 23, in <module>
MyApp().run()
File "C:/Users/JLHI6/AppData/Local/Programs/Python/Python38-32/Scripts/Prueba Kivy.py", line 20, in build
return MyGrid()
File "C:/Users/JLHI6/AppData/Local/Programs/Python/Python38-32/Scripts/Prueba Kivy.py", line 13, in __init__
Upvotes: 0
Views: 2873
Reputation: 29450
This error means you have passed an argument that the class did not expect. The argument keeps getting passed up to the superclass in the super(..., self)
calls, and eventually the object
class raises this exception.
In this case the non-existent argument is multilane=False
. Perhaps you meant multiline=False
.
Upvotes: 2