GUI Python Temperature Converter help!! This is in python 2.7 and I cant figure out how to configure my radiobuttons to work with the functions. Please help! from Tkinter import * def convert():...


GUI Python Temperature Converter help!! This is in python 2.7 and I cant figure out how to configure my radiobuttons to work with the functions. Please help!


from Tkinter import *


def convert(): celTemp = celTempVar.get() fahTemp = fahTempVar.get()    if celTempVar.get() != 0.0: celToFah = (celTemp * 9/5 + 32) print celToFah fahTempVar.set(celToFah)


eliffahTempVar.get() != 0.0: fahToCel = ((fahTemp - 32) * (5/9)) print fahToCel celTempVar.set(fahToCel) #root root = Tk() root.title("Olivia's Temperature Converter") root.geometry("400x200")


#GUI setup L1=Label(root, text="Temperature Converter", font=("Times",20), bg = "yellow", fg = "blue",) L2=Label(root, text="""Pick Conversion Type:""",) R1=Radiobutton(root, text="Celcius to Fahrenheit", variable=radbtn, value="Celsius", command = celTempVar) R2=Radiobutton(root, text="Fahrenheit to Celcius", variable=radbtn, value="Farenheit", command = fahTempVar) L3=Label(root, text="Enter the temperature to convert:") E1=Entry(root, textvariable = celTempVar) somebutton=Button(root, text="Convert Temperature", command=convert) L1.pack() L2.pack() R1.pack(anchor=CENTER) R2.pack(anchor=CENTER) L3.pack() E1.pack() somebutton.pack()    root.mainloop()




May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here