diff --git a/assets/sounds/countdown.mp3 b/assets/sounds/countdown.mp3 new file mode 100644 index 0000000..2c850d8 Binary files /dev/null and b/assets/sounds/countdown.mp3 differ diff --git a/image.py b/image.py index b647573..6f3b716 100644 --- a/image.py +++ b/image.py @@ -1,6 +1,7 @@ import os import random from tkinter import * +from pygame import mixer from PIL import ImageTk, Image, ImageOps from util import Util @@ -16,6 +17,8 @@ class ImageWindow: "mirror": False, "always_on_top": False, } + mixer.init() + self.countdown_sound = mixer.Sound('assets/sounds/countdown.mp3') self.images = [] self.current_image = None self.image_label = None @@ -56,6 +59,8 @@ class ImageWindow: def update_timer(self, current): current -= 1 + if current == 10: + self.play_countdown() if current > 0: self.timer_label.configure(text=Util.format_seconds(current)) self.timer_check = self.window.after(1000, self.update_timer, current) @@ -149,3 +154,6 @@ class ImageWindow: image_to_display = ImageTk.PhotoImage(self.current_image) self.image_label.configure(image=image_to_display) self.image_label.image = image_to_display + + def play_countdown(self): + self.countdown_sound.play() diff --git a/requirements.txt b/requirements.txt index e1732c9..0721917 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ -pillow -pyinstaller \ No newline at end of file +pillow~=9.5.0 +pyinstaller +pygame~=2.4.0 \ No newline at end of file