利用easygui模块编写的华氏温度与摄氏温度转换的小程序

 -*- coding:utf-8 -*-
#Author:'Lmc'
#DATE: 2019/4/23/0023 下午 4:23:08
#FileName:tem_compare_gui.PY
import easygui
string = '' #初始化 def tem_compare(string):
string = easygui.choicebox('请选择功能!', choices=['摄氏温度转华氏温度', '华氏温度转摄氏温度'])
while string == '摄氏温度转华氏温度':
c = float(easygui.enterbox('请输入摄氏温度'))
f = c * 1.8 + 32 #华氏温度转摄氏温度公式
f1 = float('%.1f'%f)
easygui.msgbox('华氏温度为'+ str(f1))
tem_compare(string)
break while string == '华氏温度转摄氏温度':
f = float(easygui.enterbox('请输入华氏温度'))
c = (f - 32) / 1.8 #摄氏温度转华氏温度公式
c1 = float('%.1f'%c)
easygui.msgbox('温度度为' + str(c1))
tem_compare(string)
break tem_compare(string)
上一篇:Python python 基本语法


下一篇:CSS实现页面背景自动切换功能