parent
5a83727c39
commit
1d080dc103
BIN
assets/images/break.jpg
Normal file
BIN
assets/images/break.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 MiB |
@ -5,6 +5,7 @@ from PIL import ImageTk, Image, ImageOps
|
||||
|
||||
class ImagePlaceholder:
|
||||
def __init__(self, image_window, images):
|
||||
self.is_break = False
|
||||
self.current_image = None
|
||||
self.current_original_image = None
|
||||
self.image_window = image_window
|
||||
@ -15,10 +16,12 @@ class ImagePlaceholder:
|
||||
self.image_label.pack(side=TOP, fill=BOTH, expand=1)
|
||||
|
||||
def display_new_image(self):
|
||||
image_path = self.images[0]
|
||||
self.images.pop(0)
|
||||
image_path = self.images.pop(0)
|
||||
if image_path == "break":
|
||||
image_path = 'assets/images/break.gif'
|
||||
self.is_break = True
|
||||
image_path = 'assets/images/break.jpg'
|
||||
else:
|
||||
self.is_break = False
|
||||
self.current_original_image = Image.open(image_path)
|
||||
self.current_image = copy.deepcopy(self.current_original_image)
|
||||
self.apply_options()
|
||||
@ -47,11 +50,7 @@ class ImagePlaceholder:
|
||||
self.resize_image(True)
|
||||
|
||||
def load_widget(self):
|
||||
print(self.current_image.format)
|
||||
if self.current_image.format == "GIF":
|
||||
print("is gif !")
|
||||
image_to_display = ImageTk.PhotoImage(self.current_image, format = "gif -index 2")
|
||||
else:
|
||||
image_to_display = ImageTk.PhotoImage(self.current_image)
|
||||
image_to_display = ImageTk.PhotoImage(self.current_image)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user