Skip to content

Commit 62610eb

Browse files
committed
solved an bug
1 parent 471f626 commit 62610eb

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

calculator.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,12 @@ def put_dot(self):
128128
self.ponto = False
129129

130130
def erase(self):
131-
if(not self.error):
132-
if self.equation[-1] == '.':
133-
self.ponto = True
134-
self.equation = self.equation[:-1]
135-
self.update_screen()
131+
if(len(self.equation) > 0):
132+
if(not self.error):
133+
if self.equation[-1] == '.':
134+
self.ponto = True
135+
self.equation = self.equation[:-1]
136+
self.update_screen()
136137

137138
def clean(self):
138139
self.equation = ''
@@ -171,6 +172,10 @@ def equal(self):
171172

172173
finally:
173174
self.lastvar.set(eq)
175+
176+
if ('.' in self.equation):
177+
self.ponto = False
178+
174179
self.update_screen()
175180

176181
Calculadora()

0 commit comments

Comments
 (0)