I'm trying to make a keypad in Kivy, which will insert a number in a TextInput when the corresponding button is pressed. However, when I press, each button only inserts '8' in the TextInput. I have no idea why this happens.
My code:
self.key_pad = GridLayout(rows=3, cols=3, size_hint=(None, None), size=(200, 200), pos=(295, 200))
for num in range(9):
btn = Button(text=str(num), on_press=lambda new_press: self.input_field.insert_text(str(num)))
self.key_pad.add_widget(btn)