Skip to content

Instantly share code, notes, and snippets.

@rodrigo-x
Created April 8, 2022 16:30
Show Gist options
  • Save rodrigo-x/4533877e033209f129699f24150c4379 to your computer and use it in GitHub Desktop.
Save rodrigo-x/4533877e033209f129699f24150c4379 to your computer and use it in GitHub Desktop.
C to Farenheit
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import ttkbootstrap as ttk
# from ttkbootstrap.constants import *
root = ttk.Window(themename="journal")
def calcular():
F = float(textbox_one.get())
C = (F-32) * 5/9
valor_final.set(str(round(C, 1)) + 'ºC Graus Celsius')
valor_final = ttk.StringVar()
label_one = ttk.Label(root, text='Graus Fahrenheit:',
bootstyle='info')
label_one.place(x=100, y=10)
textbox_one = ttk.Entry(root)
textbox_one.place(x=100, y=35)
button_one = ttk.Button(root, text='Calcular',command=lambda:calcular(), bootstyle=(INFO, OUTLINE))
button_one.place(x=100, y=75)
label_two = ttk.Label(root, textvariable=valor_final, bootstyle='info')
label_two.place(x=100, y=120)
root.title('App - Conversor de Temperatura')
root.resizable(False, False)
root.eval('tk::PlaceWindow . center')
root.geometry('350x150')
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment