Python 3.3 GUI Program
Question: Celsius to Fahrenheit-- Write a GUI program that converts Celsius temperatures
to Fahrenheit temperatures. The user should be able to enter a Celsius
temperature, click a button, and then see the equivalent Fahrenheit
temperature. Use the following formula to make the conversion: F = 9/5C +32 F
is the Fahrenheit temperature and C is the Celsius temperature.

THIS IS THE CODE I HAVE SO FAR, THE ERROR I GET says "invalid literal for
int() with base 10: ''" I need help getting it to run correctly.

    
    
    #import
    #main function
    from tkinter import *
    def main():
        root=Tk()
    
        root.title("Some GUI")
        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=convert(someotherstring))
    
        somebutton.pack()
        E1.pack()
        L1.pack()
        root.mainloop()#main loop
    
    
    #convert Celcius to Fahrenheit
    def convert(somestring):
        thestring=""
        thestring=somestring
        cel=0
        far=0
        cel=int(thestring)
        far=(9/5*(cel))+32
        print(far)
    


Answer: Your main problem is this line;

    
    
    somebutton=Button(root, text="Total", command=convert(someotherstring))
    

...which will call `convert(someotherstring)` immediately and assign the
result to command. Since someotherstring is empty when this line is reached,
it will fail to convert the value and fail the program.

If you don't want it evaluated immediately but instead on button press, you
can use a lambda as a command;

    
    
    somebutton=Button(root, text="Total", command=lambda: convert(E1.get()))
    

...which will eliminate the use of `someotherstring` completely and just call
convert with the contents of `E1` when the button is clicked.

