-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRedo.py
More file actions
38 lines (30 loc) · 1.13 KB
/
Redo.py
File metadata and controls
38 lines (30 loc) · 1.13 KB
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
import pygame
from Colors import Color
class Redo:
def __init__(self):
self.history = {}
self.section = []
self.count = 1
self.img = pygame.image.load('./Assets/redo.png')
self.img = pygame.transform.scale(self.img, (25, 25))
def addSection(self, x, y):
if not (0 < x < 100 and 100 < y < 125) and (x, y) not in self.section:
self.section.append((x, y))
def addHistory(self):
if self.section:
self.history[self.count] = self.section
print(self.count)
self.section = []
self.count += 1
def clicked(self, screen, size):
x, y = pygame.mouse.get_pos()[0], pygame.mouse.get_pos()[1]
if x > 0 and x < 25 and y > 100 and y < 125:
self.redo(screen, size)
def redo(self, screen, size):
if self.count > 1:
for i in self.history[self.count-1]:
pygame.draw.circle(screen, Color.WHITE, i, size)
self.count = self.count - 1
print(self.count)
def drawButton(self, screen):
screen.blit(self.img, (00, 100))