-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscore.py
41 lines (32 loc) · 1.12 KB
/
score.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from graphics import *
from vector import Vector
class Score:
def __init__(self, window: GraphWin):
self.pts = 0
self.window = window
position = Vector(400, 575)
half_size = Vector(75, 20)
self.pontos = Text(Point(400, 575), f"Pontos: {self.pts}")
self.pontos.setSize(14)
self.background = Rectangle((position + half_size).to_point(), (position - half_size).to_point())
self.background.setFill(color_rgb(230, 230, 230))
self.background.setOutline("black")
def draw(self):
self.background.draw(self.window)
self.pontos.setText(f"Pontos: {self.pts}")
self.pontos.draw(self.window)
def undraw(self):
self.background.undraw()
self.pontos.undraw()
def add_score(self):
self.pts += 1
self.pontos.setText(f"Pontos: {self.pts}")
def reset(self):
self.pts = 0
self.pontos.setText(f"Pontos: {self.pts}")
# def score(pts, pontos, win):
# pts += 1
# pontos.undraw()
# pontos = Text(Point(400, 575), "Pontos: " + str(pts))
# pontos.setSize(14)
# pontos.draw(win)