Почему в kivy не работает команда on_prees
Помогите пожалуйста! Начал учить kivy, на питоне, до этого работал с tkinter, и столкнулся с такой проблемой. Начал делать калькулятор, по 3 уроке от Хауди Хо, сделал все так как у него, кроме переменных, и он запустился, но кнопки не работают, ни одна. Заранее спасибо, буду очень благодарен. Вот код:
from kivy.app import App
from kivy.config import Config
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
Config.set("graphics", "resizable", "0")
Config.set("graphics", "width", "400")
Config.set("graphics", "height", "500")
class MyCalculatorApp(App):
def command_vlab(self):
self.lbl.text = self.formula
def command_namber(self, instance):
if (self.formula == "0"):
self.formula = "0"
self.formula += str(instance.text)
self.vlab()
def command_operation(self, instance):
if (str(instance.text).lower() == "x"):
self.formula += "*"
else:
self.formula += str(instance.text)
self.vlab()
def command_r(self, instance):
self.lbl.text = str(eval(self.lbl.text))
self.formula = "0"
def build(self):
self.formula = "0"
b = BoxLayout(orientation = "vertical", padding = 25)
a = GridLayout(cols = 4, spacing = 3, size_hint = (1, 6))
self.lbl = Label(text = "0", font_size = 30, size_hint = (1, 4), halign = "right", text_size =
(400 - 50, 500 * .4 - 50))
b.add_widget(self.lbl)
a.add_widget(Button(text = "9", on_prees = self.command_namber))
a.add_widget(Button(text = "8", on_prees = self.command_namber))
a.add_widget(Button(text = "7", on_prees = self.command_namber))
a.add_widget(Button(text = "÷", on_prees = self.command_operation))
a.add_widget(Button(text = "6", on_prees = self.command_namber))
a.add_widget(Button(text = "5", on_prees = self.command_namber))
a.add_widget(Button(text = "4", on_prees = self.command_namber))
a.add_widget(Button(text = "x", on_prees = self.command_operation))
a.add_widget(Button(text = "3", on_prees = self.command_namber))
a.add_widget(Button(text = "2", on_prees = self.command_namber))
a.add_widget(Button(text = "1", on_prees = self.command_namber))
a.add_widget(Button(text = "-", on_prees = self.command_operation))
a.add_widget(Button(text = ".", on_prees = self.command_namber))
a.add_widget(Button(text = "0", on_prees = self.command_namber))
a.add_widget(Button(text = "=", on_prees = self.command_namber))
a.add_widget(Button(text = "+", on_prees = self.command_operation))
b.add_widget(a)
return b
if __name__ == "__main__":
MyCalculatorApp().run()