#6 测试
#6.1如何使用easygui生成消息框
import easygui
easygui.msgbox("Hi,guys.")
#6.2如何使用easygui得到字符串
import easygui
floavor = easygui.enterbox()
easygui.msgbox(floavor)
#6.3如何使用easygui得到整数输入
import easygui
zs = easygui.integerbox()
easygui.msgbox(zs)
#6.4如何使用easygui得到浮点型
import easygui
fd = easygui.enterbox()
easygui.msgbox(fd)
#6.5如何使用easygui 得到默认值
import easygui
floavor = easygui.enterbox("What's your favorite ice cream flavor?",
default ='Vanilla')
easygui.msgbox("You entered" + floavor)
6 动手试一试
6.1修改第五章温度转换程序,这一次使用GUI输入和输出而不是input()
import easygui
easygui.msgbox("This program converts Fahrenheit to Celsius")
easygui.msgbox("Type in a temperature in Fahrenheit:")
fahrenheit = easygui.integerbox("输入华氏温度")#华氏温度
ceisius = (fahrenheit-32)*5.0 /9 #摄氏温度,人正常体温37摄氏温度
easygui.msgbox("That is celsius"+str(ceisius))
6.2 姓名,房间号,街道,城市 省,市地区,邮编
import easygui
name =easygui.enterbox("请问您姓名:")
No =easygui.enterbox("请问您房间号:")
street =easygui.enterbox("请问您街道:")
province =easygui.enterbox("请问您哪个省:")
city=easygui.enterbox("请问您的城市")
zipcode =easygui.enterbox("请问您邮编")
alladdress = name+"\n"+No+","+street+"\n"+province+","+city+"\n"+zipcode #\n换行
easygui.msgbox()
#6.1如何使用easygui生成消息框
import easygui
easygui.msgbox("Hi,guys.")
#6.2如何使用easygui得到字符串
import easygui
floavor = easygui.enterbox()
easygui.msgbox(floavor)
#6.3如何使用easygui得到整数输入
import easygui
zs = easygui.integerbox()
easygui.msgbox(zs)
#6.4如何使用easygui得到浮点型
import easygui
fd = easygui.enterbox()
easygui.msgbox(fd)
#6.5如何使用easygui 得到默认值
import easygui
floavor = easygui.enterbox("What's your favorite ice cream flavor?",
default ='Vanilla')
easygui.msgbox("You entered" + floavor)
6 动手试一试
6.1修改第五章温度转换程序,这一次使用GUI输入和输出而不是input()
import easygui
easygui.msgbox("This program converts Fahrenheit to Celsius")
easygui.msgbox("Type in a temperature in Fahrenheit:")
fahrenheit = easygui.integerbox("输入华氏温度")#华氏温度
ceisius = (fahrenheit-32)*5.0 /9 #摄氏温度,人正常体温37摄氏温度
easygui.msgbox("That is celsius"+str(ceisius))
6.2 姓名,房间号,街道,城市 省,市地区,邮编
import easygui
name =easygui.enterbox("请问您姓名:")
No =easygui.enterbox("请问您房间号:")
street =easygui.enterbox("请问您街道:")
province =easygui.enterbox("请问您哪个省:")
city=easygui.enterbox("请问您的城市")
zipcode =easygui.enterbox("请问您邮编")
alladdress = name+"\n"+No+","+street+"\n"+province+","+city+"\n"+zipcode #\n换行
easygui.msgbox()
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/220205/viewspace-2073511/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/220205/viewspace-2073511/