Python 3 Tkinter Temperature Converter Fahrenheit to Celsius GUI Desktop App Full Project For Beginners

Python 3 Tkinter Temperature Converter Fahrenheit to Celsius GUI Desktop App Full Project For Beginners

 

 

Welcome folks today in this blog post we will be building a fahrenheit to celsius temperature converter gui desktop app in tkinter using python. All the full source code of application is shown below.

 

 

Get Started

 

 

In order to get started you need to make an app.py file and copy paste the following code

See also  Python 3 Script to Generate Random Youtube Video ID Using Youtube Data API V3 Full Project For Beginners

 

app.py

 

#!/usr/bin/python3

# Converts Fahrenheit to Celsius

import tkinter


def convert_to_celsius():
    fahrenheit = float(input_box.get())
    celsius = (fahrenheit-32)*5/9
    output_label.config(text=round(celsius, 2))


window = tkinter.Tk()
window.title("C to F Converter")
window.minsize(width=250, height=50)

input_box = tkinter.Entry(justify=tkinter.RIGHT)
output_label = tkinter.Label(text="", justify=tkinter.RIGHT, width=8)
action_button = tkinter.Button(text='Convert', command=convert_to_celsius)

input_box.pack(padx=20, pady=20)
output_label.pack(padx=20, pady=20, side=tkinter.RIGHT)
action_button.pack(padx=20, pady=20)


window.mainloop()

 

 

Now if you execute the python script by typing the below command as shown below

 

python app.py

 

See also  Python 3 Script to Convert SnakeCase String to CamelCase String Full Project For Beginners

 

Leave a Reply