-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscoreboard.py
More file actions
22 lines (20 loc) · 752 Bytes
/
scoreboard.py
File metadata and controls
22 lines (20 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from turtle import Turtle
class Scoreboard(Turtle):
def __init__(self):
super().__init__()
self.penup()
self.goto(0,260)
self.hideturtle()
self.color("white")
self.write("0 Score 0",False, "center", ("Arial",24,"normal"))
self.left = 0
self.right = 0
def score(self, who):
if(who == "left"):
self.clear()
self.left += 1
self.write(f"{self.left} Score {self.right}",False, "center", ("Arial",24,"normal"))
if(who == "right"):
self.clear()
self.right += 1
self.write(f"{self.left} Score {self.right}",False, "center", ("Arial",24,"normal"))