import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
import math
class MyGrid(GridLayout):
def __init__(self, **kwargs):
super(MyGrid, self).__init__(**kwargs)
self.cols = 1
self.inside = GridLayout()
self.inside.cols = 2
self.inside.add_widget(Label(text="NUM1: "))
self.num1 = TextInput(multiline=False)
self.inside.add_widget(self.num1)
self.inside.add_widget(Label(text="NUM2: "))
self.num2 = TextInput(multiline=False)
self.inside.add_widget(self.num2)
self.inside.add_widget(Label(text="ANSWER: "))
self.answer = TextInput(multiline=False)
self.inside.add_widget(self.answer)
self.add_widget(self.inside)
self.clear = Button(text="Clear", font_size=20)
self.clear.bind(on_press=self.pressed)
self.add_widget(self.clear)
def pressed (self, instance):
num1 = self.num1.text
num2 = self.num2.text
answer = self.answer.text
print("num1:", num1, "num2:", num2, "answer:", answer)
def numbermultiplier(num1, num2):
ans = num1 * num2
return ans
print(numbermultiplier(12700.00,5.63))
class MyApp(App):
def build(self):
return MyGrid()
if __name__ == "__main__":
MyApp().run()