enter image description hereI’m writing a simple code for executing an application in python kivy module I use Pycharm, the syntax is okay but its returning an error saying:
File "C:UsersUSERPycharmProjectspythonProject7main.py", line 12, in <module> TestNas().run() TypeError: TestNas() missing 1 required positional argument: 'app'
I was expecting it to start the simple Kivy Gui but it did not.
import kivy from kivy.app import App from kivy.uix.label import Label def TestNas(app): def build(self): return Label(Text="Test this app") if __name__ == '__main__': TestNas().run()
Advertisement
Answer
First of all TestNas() should be a class and I’m guessing it needs to be a subclass of App() that you imported. So change TestNas() to a class and capitalize App().
I think this is the code you need:
import kivy from kivy.app import App from kivy.uix.label import Label class TestNas(App): def build(self): return Label(Text="Test this app") if __name__ == '__main__': TestNas().run()