Add not cheated pause

For #36
This commit is contained in:
2024-06-14 17:32:44 +02:00
parent 328b7a0e49
commit a8c0979ef1
4 changed files with 33 additions and 1 deletions

View File

@@ -8,8 +8,10 @@ from PIL import ImageTk, Image, ImageOps
class ImagePlaceholder:
def __init__(self, image_window, images):
self.is_break = False
self.is_pause = False
self.current_image = None
self.current_original_image = None
self.paused_original_image = None
self.image_window = image_window
self.images = images.copy()
@@ -61,3 +63,16 @@ class ImagePlaceholder:
self.image_label.configure(bg="#e8d4bc" if self.is_break else "#FFFFFF")
self.image_label.configure(image=image_to_display)
self.image_label.image = image_to_display
def pause(self):
if self.is_pause:
self.is_pause = False
self.current_original_image = self.paused_original_image
self.paused_original_image = None
else:
self.is_pause = True
self.paused_original_image = self.current_original_image
image_path = 'assets/images/break.jpg'
self.current_original_image = Image.open(image_path)
self.current_image = copy.deepcopy(self.current_original_image)
self.apply_options()