from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.core.window import Window
Window.size=(800,800)
Window.clearcolor=(1,1,1,1)
class bl4(App):
def build(self):
bl=BoxLayout(orientation="vertical",spacing=20,padding=25)
self.t1=TextInput(text="enter 1st number")
self.t2=TextInput(text="enter 2nd number")
self.t3=TextInput(text="result here")
b1=Button(text="LCM",on_press=self.lcm)
b2=Button(text="HCF",on_press=self.hcf)
bl.add_widget(self.t1)
bl.add_widget(self.t2)
bl.add_widget(self.t3)
bl.add_widget(b1)
b1.add_widget(b2)
return bl
def lcm(self,obj1):
a=int(self.t1.text)
b=int(self.t2.text)
if(a>b):
c=a
else:
c=b
while True:
if(c%a==0 and c%b==0):
break
else:
c=c+1
def hcf(self,obj2):
d=int(self.t1.text)
e=int(self.t2.text)
h=1
for l in range(2,d+1):
if(d%i==0 and e%i==0):
h=i
self.t3.text=str(h)
o2=bl4()
o2.run()