python - kivy: __init__() is missing x required positional arguments -
i have class movie follows:
class movie(widget): def __init__(self, title, image, time, description, trailer, fsk, threed, **kwargs): super(movie, self).__init__(title, image, time, description, trailer, fsk, threed, **kwargs) title = stringproperty() image = stringproperty() time = stringproperty() description = stringproperty() trailer = stringproperty() fsk = numericproperty() threed = booleanproperty()
when run script python interpreter tells me this:
typeerror: __init__() missing 7 required positional arguments: 'title', 'image', 'time', 'description', 'trailer', 'fsk', , 'threed'
so doing wrong? struggle time already.
whole source code relevant issue:
class movie(widget): def __init__(self, title, image, time, description, trailer, fsk, threed, **kwargs): super(movie, self).__init__(title, image, time, description, trailer, fsk, threed, **kwargs) title = stringproperty() image = stringproperty() time = stringproperty() description = stringproperty() trailer = stringproperty() fsk = numericproperty() threed = booleanproperty() class mainview(widget): def __init__(self, **kwargs): super(mainview, self).__init__(**kwargs) movies = listproperty() # movies = self.getmovies() # movie in movies: # self.add_widget(movie) def getmovies(self, url="http://.../"): html = lxml.html.parse(url) titles = html.xpath("//h5") times = html.xpath("//td[@class='pday ptoday']/span/a") trailers = html.xpath("//a[@data-modal-trailer-url]/@data-modal-trailer-url") fsks = html.xpath("//tr[@data-fsk]/@data-fsk") movies = list() # in range(0, len(titles)): # movie = movie(titles[i].text, "images[i]", times[i].text, "", "https:" + trailers[i][:-11], fsks[i], "no") # movies.append(movie) return movies
i've found out kv-lang-file reason object initialization error. don't know how fix think other question why __init__
being called
Comments
Post a Comment