I made a calculator using tkinter
but it doesn't work
I think CoolProp library is a problem but i don't know what to do
What can i do now How can i fix it?
import tkinter
from CoolProp.HumidAirProp import HAPropsSI
def click_btn():
txt1 = input(entry1.get())
txt2 = input(entry2.get())
txt3 = HAPropsSI('H','T',txt1 273.15,'P',101325,'R',txt2)
button["text"] = txt3
win = tkinter.Tk()
win.title("엔트리(텍스트 입력 필드) 사용하기")
win.geometry("400x400")
# 첫번째 입력
entry1 = tkinter.Entry(width=30)
entry1.place(x=20, y=20)
# 두번째 입력
entry2 = tkinter.Entry(width=30)
entry2.place(x=20, y=40)
button = tkinter.Button(text="Calculate enthalphy", command=click_btn)
button.place(x=20, y=70)
win.mainloop()
CodePudding user response:
your problems is that input
waits for user input in the terminal, you should be using float
instead to convert the text in the textbox to a number for the library.
def click_btn():
txt1 = float(entry1.get())
txt2 = float(entry2.get())
txt3 = HAPropsSI('H','T',txt1 273.15,'P',101325,'R',txt2)
button["text"] = txt3