Add a countdown #25

Merged
Shikiryu merged 1 commits from feature/countdown into main 2023-05-23 22:19:13 +02:00
3 changed files with 11 additions and 2 deletions
Showing only changes of commit 0bd8f97f14 - Show all commits

BIN
assets/sounds/countdown.mp3 Normal file

Binary file not shown.

View File

@ -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()

View File

@ -1,2 +1,3 @@
pillow
pillow~=9.5.0
pyinstaller
pygame~=2.4.0