What I am trying to do:
A GUI with tkinter to covert Celsius to Fahrenheit.
What is happening
The window itself is working but then when I try to call the calc
function with a button it returns an error:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.6/tkinter/__init__.py", line 1705, in __call__
return self.func(*args)
TypeError: calc() missing 1 required positional argument: 'grausC'
My code:
from tkinter import *
janela = Tk()
janela.title("Conversao")
janela.geometry("600x600")
def calc(grausC):
graus = float(grausC.get())
Fahrenheit = (graus * 9/5 + 32)
lb3=Label(janela, text=CalcF)
lb3.place(x=200, y=200)
titulo=Label(janela, text="Conversao de Celsius para Fahrenheit", font=("Verdana 20 underline"))
titulo.place(x=20, y=20)
grausC = Entry(janela)
grausC.place(x=200,y=150)
lb1=Label(janela, text="Graus em Celsius:")
lb1.place(x=70, y=150)
lb2=Label(janela, text="Graus em Fahrenheit:")
lb2.place(x=70, y=200)
btn=Button(janela, text= "Calcular", command=calc)
btn.place(x=100, y = 250)
janela.mainloop()