How to make a GUI calculator in Android with python
How to make GUI calculator in python:
First install tkinter module in your pydroid IDE ,if you not have pydroid IDE then you can install it from Google play store.
Then go in terminal and paste the folowing code:
import tkinter
from tkinter import*
t=Tk()
p=IntVar()
q=IntVar()
def add():
a=p.get()
b=q.get()
c=a+b
l3.config(text=c)
l1=Label()
l1.pack()
e1=Entry(t,textvariable=p)
e1.pack()
l2=Label(t,text="enter second value")
l2.pack()
e2=Entry(t,textvariable=q)
e2.pack()
b=Button(t,text="add",command=add)
b.pack()
l3=Label(t,text="result")
l3.pack()
t.mainloop()
And then press the run button in pydroid .
Your calculator is ready.
Comments
Post a Comment