I am writing a program in Kivy, and whenever I am trying to bind a function to a Button or any other widget I get the following problem from pylint: "Instance of 'Button' has no 'bind' member" and the lines turn red. I am completely new to Kivy and this really bugs me.
The program works perfect when I execute it, and the compiler does not seem to have any problem with my bindings. What have I done wrong? Am I missing an import or anything, or is there something wrong with my environment?
Attached you find a code snippet I wrote as an example.
from kivy.app import App
from kivy.uix.button import Button
class MainApp(App):
def build(self):
button = Button(text='Hello from Kivy',
size_hint=(.5, .5),
pos_hint={'center_x': .5, 'center_y': .5})
button.bind(on_press=self.on_press_button)
return button
def on_press_button(self, instance):
print('You pressed the button!')
if __name__ == '__main__':
app = MainApp()
app.run()