Reputation: 79
I'm pretty new to kivy. I want to call a function in the App class. But it gives an error. The error is "on_press: app.hello() TypeError: hello() takes 0 positional arguments but 1 was given"
.kv file code
Button:
id: add_income_btn
size_hint: (.05, .2)
pos: (393, 302)
background_color: (1, 1, 1, 0)
text: "+"
font_size:'20sp'
on_press: app.hello()
.py file code
Builder.load_file("test1.kv")
class Money_Manager(App,TabbedPanel):
def hello():
print("Hello")
Upvotes: 0
Views: 68
Reputation: 2231
The methods of an instantiated Class in Python need a self
argument (the current Class instance).
So you must use:
def hello(self):
print("Hello")
Upvotes: 1