diff --git a/calc.py b/calc.py index e7c6b9e4026b2373355f91d2101bb2e8d72a3427..bffda30de14fe151c13a448078fc0598652155d5 100644 --- a/calc.py +++ b/calc.py @@ -71,7 +71,8 @@ class Calc(QMainWindow): else:#无y if value != '0': self.y = value - self.text_result.setText(self.y) + if self.y is not None: + self.text_result.setText(self.y) else:#无运算符 if self.x is not None:#有x @@ -80,7 +81,8 @@ class Calc(QMainWindow): else: if value != '0': self.x = value - self.text_result.setText(self.x) + if self.x is not None: + self.text_result.setText(self.x) # 开始处理运算符