import graphics as gph def main(): #program to convert temperature, degrees celsius, to # temperature in degrees fahrenheit #construct GUI interface win=gph.GraphWin("Temperature Converter",400,300) win.setCoords(0,0,3,4) gph.Text(gph.Point(1.25,3)," Celsius Temperature:").draw(win) gph.Text(gph.Point(1.25,1),"Fahrenheit Temperature:").draw(win) tempInput=gph.Entry(gph.Point(2.25,3),8) tempInput.draw(win) tempInput.setText("0.0") tempOutput=gph.Text(gph.Point(2.15,1),"") tempOutput.draw(win) #pseudo button gph.Rectangle(gph.Point(1,1.5),gph.Point(2,2.5)).draw(win) #button text buttonText=gph.Text(gph.Point(1.5,2),"CONVERT!") buttonText.draw(win) #wait for button click to convert temperature win.getMouse() #convert the temperature celsius=float(tempInput.getText()) fahrenheit=(9/5)*celsius+32 #display converted temperature tempOutput.setText(str(round(fahrenheit,3))) #quit the program and close GUI buttonText.setText("QUIT") win.getMouse() win.close() main()