Answer the question
In order to leave comments, you need to log in
How to follow the example? Is there an error in the code?
Here is the code:
from tkinter import*
def rass():
if var1.get()==1 and var2.get()==2 and var3.get()==3 and var4.get()==4:
b =e1.get()+e2.get()
c=b*e2.get()
d=b*var1.get()+c
a=e1.get()+b
a=e3
e3.delete(0, END)
e3.insert(0,a)
w=Tk()
l1=Label(w,text="Enter loan amount")
l2=Label(w,text="Enter annual percentage")
e1=Entry(w)
e2 =Entry(w)
var1=IntVar()
var1.set(1)
r1=Radiobutton(w,text="1 year",variable=var1,value=1)
r2=Radiobutton(w,text="2 years", variable=var1,value=2)
r3=Radiobutton(w,text="5 years",variable=var1,value=3)
r4=Radiobutton(w,text="10 years",variable=var1,value=4)
b1=Button(w,text="Calculate",command=rass)
l3=Label(w,text="How much money to return ")
e3=Entry(w)
l1.grid(row=1,column=1,columnspan=2,sticky="swen")
l2.grid(row=1,column=3,columnspan=2,sticky="swen ")
e1.grid(row=2,column=1,columnspan=2,sticky="swen")
e2.grid(row=2,column=3,columnspan=2,sticky="swen")
r1.grid( row=3,column=1,sticky="swen")
r2.grid(row=3,column=2,sticky="swen")
r3.grid(row=3,column=3,sticky="swen")
r4.grid(row=3,column=4,sticky="swen")
b1.grid(row=4,column=1,columnspan=4,sticky="swen")
l3.grid(row=5,column=1,columnspan=4,sticky="swen")
e3.grid(row=6,column=1,columnspan=4,sticky="swen")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question