Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

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)

elif fahTempVar.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()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

l Discuss three types of individual incentives.

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago