import easygui class Pets(): def __init__(self,x,y,y1,y2,y3): self.x = float(x) self.y = float(y) self.y1 = float(y1) self.y2 = float(y2) self.y3 = float(y3) def single(self): z = self.y * 0.2565 + self.x * 89.5865 + 37.767 z1 = self.y1 * 0.2565 + self.x * 89.5865 + 37.767 z2 = self.y2 * 0.2565 + self.x * 89.5865 + 37.767 z3 = self.y3 * 0.2565 + self.x * 89.5865 + 37.767 s = easygui.buttonbox(msg=['满级满星斗志属性:', z,'满级满星健体属性:',z1], title='计算结果', choices=('再来一次', '结束')) return s def score(self): Y1 = (96.4 - 0.0035 * self.y) * self.x + 0.2886 * self.y - 26.26 Y2 = (96.4 - 0.0035 * self.y2) * self.x + 0.2886 * self.y2 - 26.26 z = Y1 / 1698 * 66.7 + Y2 / 1693 * 33.3 s = easygui.buttonbox(msg=('该属性为:', z), title='计算结果', choices=('再来一次', '结束')) return s
from PETS.sl import * import easygui import sys # C = Pets() s = '再来一次' while s == '再来一次': ret=easygui.buttonbox(msg='请选择计算单项资质或总评分',title='选择页',choices=('单项属性计算','计算总评分'),image='') if ret == '单项属性计算': zet = easygui.multenterbox(msg='请输入相关数据',title='数据填写',fields=['宠物成长率','斗志','健体','忠心','灵动']) x = zet[0] y = zet[1] y1 = zet[2] y2 = zet[3] y3 = zet[4] C = Pets(x,y,y1,y2,y3) s = C.single() pass else: cet = easygui.multenterbox(msg='请输入相关数据', title='数据填写', fields=['主属性资质', '副属性资质','宠物成长率']) x = cet[2] y = cet[0] y2 = cet[1] y1 = 0 y3 = 0 C = Pets(x, y, y1, y2, y3) s = C.score() else: sys.exit(0)