import easygui as e |
s = e.buttonbox(msg = '请选择' ,choices = ( '计算长方形的面积' , '计算正方形的面积' , '计算正方体的体积' , '计算长方体的体积' , '计算正方体的表面积' , '计算长方体的表面积' )) |
if s = = '计算长方形的面积' : |
while True : |
h = e.enterbox(msg = '请输入长方形的长' ,title = '计算长方形的面积' ) |
w = e.enterbox(msg = '请输入长方形的宽' ,title = '计算长方形的面积' ) |
if h is not None or w is not None : |
e.msgbox(msg = '长方形的面积是:' + str ( int (h) * int (w)),ok_button = '好的' ) |
break |
else : |
e.msgbox( '请输入' ) |
if s = = '计算正方形的面积' : |
while True : |
h2 = e.enterbox(msg = '请输入正方形的边长' ,title = '计算正方形的面积' ) |
if h2 is not None : |
e.msgbox( '正方形的面积是:' + str ( int (h2) * int (h2)),ok_button = '好的' ) |
break |
else : |
e.msgbox( '请输入' ) |
if s = = '计算正方体的体积' : |
while True : |
h3 = e.enterbox(msg = '请输入正方体的棱长' , title = '计算正方体的体积' ) |
if h3 is not None : |
e.msgbox(msg = '正方体的体积是:' + str ( int (h3) * int (h3) * int (h3)),ok_button = '好的' ) |
break |
else : |
e.msgbox( '请输入' ) |
if s = = '计算长方体的体积' : |
while True : |
h4 = e.enterbox(msg = '请输入长方体的长' ,title = '计算长方体的体积' ) |
w2 = e.enterbox(msg = '请输入长方体的宽' ,title = '计算长方体的体积' ) |
g = e.enterbox(msg = '请输入长方体的高' ,title = '计算长方体的体积' ) |
if h4 is not None or w2 is not None or g is not None : |
e.msgbox(msg = '长方体的体积是:' + str ( int (h4) * int (w2) * int (g)),ok_button = '好的' ) |
break |
else : |
e.msgbox( '请输入' ) |
if s = = '计算正方体的表面积' : |
while True : |
h3d = e.enterbox(msg = '请输入正方体的棱长' , title = '计算正方体的表面积' ) |
if h3d is not None : |
e.msgbox(msg = '正方体的表面积是:' + str ( int (h3d) * int (h3d) * 6 ),ok_button = '好的' ) |
break |
else : |
e.msgbox( '请输入' ) |
if s = = '计算长方体的表面积' : |
while True : |
h4d = e.enterbox(msg = '请输入长方体的长' ,title = '计算长方体的表面积' ) |
w2d = e.enterbox(msg = '请输入长方体的宽' ,title = '计算长方体的表面积' ) |
gd = e.enterbox(msg = '请输入长方体的高' ,title = '计算长方体的表面积' ) |
if h4d is not None or w2d is not None or gd is not None : |
ddds = int (h4d) * int (w2d) + int (w2d) * int (gd) + int (h4d) * int (gd) |
e.msgbox(msg = '长方体的表面积是:' + str (ddds * 2 ),ok_button = '好的' ) |
break |
else : |
e.msgbox( '请输入' ) |
初级程序员
by: 马牛逼 发表于:2022-01-31 14:59:48 顶(0) | 踩(0) 回复
计算长方体的表面积的代码有一行写错了:倒数第四行msg内容应该是‘长方体的表面积是:’
回复评论