D
D
Denis Mustafin2019-11-01 18:35:00
Python
Denis Mustafin, 2019-11-01 18:35:00

How to get rid of object.__init__() takes no arguments?

I can't figure out what is wrong with me. I did everything according to the example in the documentation, still the same error ...
The code itself:

from kivy.app import App
from kivy.uix.image import Image
from kivy.uix.widget import Widget


class Image(App):
  def build(self):
    root = Widget()
    root.add_widget(Image(source = "brother1.png"))
    return root


if __name__ == '__main__':
  Image().run()

Mistake
Traceback (most recent call last):
   File "picture.py", line 12, in <module>
     Image().run()
   File "/home/karacb/Desktop/Python/kivy/app.py", line 949, in run
     self._run_prepare()
   File "/home/karacb/Desktop/Python/kivy/app.py", line 919, in _run_prepare
     root = self.build()
   File "picture.py", line 7, in build
     root.add_widget(Image(souce = "brother1.png"))
   File "/home/karacb/Desktop/Python/kivy/app.py", line 567, in __init__
     super(App, self).__init__(**kwargs)
   File "kivy/_event.pyx", line 245, in kivy._event.EventDispatcher.__init__
 TypeError: object.__init__() takes no arguments

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Mustafin, 2019-11-01
@DenisCompany

People, don't be stupid like me! The error is that the name of the class and the widget matched ... Accordingly, the program did not understand where the second argument came from, if only self exists.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question