四舍五入计算器,第一个python—gui程序

来源:互联网 发布:mac网速慢的解决办法 编辑:程序博客网 时间:2024/06/05 10:29
# test2.py# coding=utf-8def hello(b):c = int(b)if b - c >= 0.5: c = c + 1else:pass;return c'''while 1:b = raw_input("Enter you num:")b = float(b)hello(b)'''# coding=utf-8import easyguiimport test2choice  =  easygui.buttonbox("欢迎使用" ,"四舍五入计算器" ,choices=("Enter" , "Cancel"))if choice == "Enter" :num = easygui.enterbox("Enter you num :" ,"game" , default=0.0000)result = test2.hello(float(num))easygui.msgbox("the result is : %d" % result , "四舍五入计算器")

0 0