Getting Typeerror: Object.__init__() Takes No Parameters Kivy
I developed an app with python and faced this problem: TypeError: object.__init__() takes no parameters My files are the following : Main.py: from kivy.app import App from kivy.la
Solution 1:
As inclement stated out correctly you pass an argument to the class that does not exist C = ClinicBanner(cities=row[1])
. It is the cities argument. If you use it this way you better write your init method like this:
def __init__(self, cities, **kwargs):
super(ClinicBanner, self).__init__(**kwargs)
centre = FloatLayout() centre_label = Label(text=cities, size_hint=(1, .2), pos_hint={"top": .2, "left": 1})
I added cities to the init method as an argument and changed the labels text to cities (I assume cities is a str). This way it should work, but if you create a new instance of ClinicBanner you now always have to add a cities argument. If you dont want that you can change the init method to def __init__(self, cities="", **kwargs):
to add an empty string as default. I hope, it now works for you.
Post a Comment for "Getting Typeerror: Object.__init__() Takes No Parameters Kivy"