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=(300,300)
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="Enter 3rd number : ")
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)
Bl.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
self.t3.text=str(c)
def hcf(self,obj2):
d=int(self.t1.text)
e=int(self.t2.text)
h=1
for i in range(2,d+1):
if(d%i==0 and e%i==0):
h=i
self.t3.text=str(h)
x=bl4()
x.run()