오류 코드는 다음과 같습니다. tkinter를 사용하여 문자열을 float로 변환 할 수 없습니다.
line 83, in qu2
wins = float(wins)
ValueError: could not convert string to float:
이
이 어떤 도움에 감사드립니다 오류가 wins = wins_box.get()
draws = draws_box.get()
loses = losses_box.get()
wins = float(wins)
draws = float(draws)
loses = float(loses)
total_score = 0
total_score = total_score + wins * 3
total_score = total_score + draws * 2
total_score = total_score + loses
yourvar = tkinter.StringVar()
yourvar.set(total_score)
totalscore1 = tkinter.Label(q3, textvariable=yourvar)
totalscore1.pack()
에 표시되는 코드입니다, 감사합니다.
로 값을 변환하지 않아도 그런 식으로 당신은해야''인쇄가()''당신''wins'' 변수 - 그것의 소리에서, 그것은 포함 float로 변환 할 수없는 문자열. –
나는 시도해 본 결과 tkinter의 창으로 스코어를 사용하려고하는데, 평소에는 pritned되지 않았다. – Leeeaaann
빈 문자열을 float로 변환하려고합니다. 이것을 디버그하는 간단한 방법은 값을 변환하기 전에 인쇄하는 것입니다. –