Question

(in python) Write a GUI application that converts Celsius temperatures to Fahrenheit temperatures. The user s......

(in python) Write a GUI application that converts Celsius temperatures to Fahrenheit temperatures. The user s... Write a GUI application that converts Celsius temperatures to Fahrenheit temperatures. The user should be able to enter a Celsius temperature, click a button, and then see the equivalent Fahrenheit temperature. Use the following formula to make the conversion ( F=9/5 C + 32) where F is the Fahrenheit temperature and C is the Celsius temperature

0 0
Add a comment Improve this question Transcribed image text
Answer #1

GUI Application in Python

import tkinter as tk
from functools import partial
# the main conversion
def celisus_to_fahrenheit(celsius_label, celsius):
    celsius_temp = celsius.get()
    celsius_float = float((float(celsius_temp) * 9 / 5) + 32)
    celsius_label.config(text="%f Fahrenheit" % celsius_float)
    return

main = tk.Tk()
main.geometry('350x100')
main.title('Celsius to Fahrenheit Converter')
main.resizable(width=False, height=False)


celsius = tk.StringVar()

celsius_label = tk.Label(main, text="Enter Celsius")
celsius_entry = tk.Entry(main, textvariable=celsius)
celsius_label.grid(row=1)
celsius_entry.grid(row=1, column=2)


celsius_field = tk.Label(main)
celsius_field.grid(row=6, columnspan=4)

celisus_to_fahrenheit = partial(celisus_to_fahrenheit, celsius_field, celsius)
convert_button = tk.Button(main, text="Convert", command=celisus_to_fahrenheit)
convert_button.grid(row=3, columnspan=4)

main.mainloop()

Output

Add a comment
Know the answer?
Add Answer to:
(in python) Write a GUI application that converts Celsius temperatures to Fahrenheit temperatures. The user s......
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT