-1
これはGUIを備えた温度コンバータです。私はGUIの側面に問題があります。 GUIに追加する前に私のコードが正しく実行されていたので、実際にプログラムを実行すると何も起こりません。 Tkinterファイルが同じフォルダにある可能性があるので、私はそれがわからないのですか?以前にファイルからテキストを取得しているとき、またはGUIが完全に間違ってプログラムされていると、その問題が発生しました。ありがとう!GUIを使用した温度コンバータ
#import
#main function
from Tkinter import *
def main():
root=Tk()
root.title("Temperature Converter")
root.geometry("400x700")
#someothersting=""
someotherstring=""
#enter Celcius
L1=Label(root,text="Enter a Celcius temperature.")
E1=Entry(root,textvariable=someotherstring)
somebutton=Button(root, text="Total", command=lambda: convert(E1.get()))
somebutton.pack()
E1.pack()
L1.pack()
root.mainloop()#main loop
#convert Celcius to Fahrenheit
def convert(somestring):
if somestring != "":
# cel=0 dont need these in python
# far=0
cel=int(somestring)
far=(9/5*(cel))+32
print(F)
これはPython 2でもあります。 –
多くの言語で自動的に 'main'が呼び出されますが、Pythonはそれらのどれでもありません。最後に 'main()'を追加してみてください。 – Kevin