parent
273afa6aee
commit
0bd8f97f14
BIN
assets/sounds/countdown.mp3
Normal file
BIN
assets/sounds/countdown.mp3
Normal file
Binary file not shown.
8
image.py
8
image.py
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
from pygame import mixer
|
||||||
from PIL import ImageTk, Image, ImageOps
|
from PIL import ImageTk, Image, ImageOps
|
||||||
from util import Util
|
from util import Util
|
||||||
|
|
||||||
@ -16,6 +17,8 @@ class ImageWindow:
|
|||||||
"mirror": False,
|
"mirror": False,
|
||||||
"always_on_top": False,
|
"always_on_top": False,
|
||||||
}
|
}
|
||||||
|
mixer.init()
|
||||||
|
self.countdown_sound = mixer.Sound('assets/sounds/countdown.mp3')
|
||||||
self.images = []
|
self.images = []
|
||||||
self.current_image = None
|
self.current_image = None
|
||||||
self.image_label = None
|
self.image_label = None
|
||||||
@ -56,6 +59,8 @@ class ImageWindow:
|
|||||||
|
|
||||||
def update_timer(self, current):
|
def update_timer(self, current):
|
||||||
current -= 1
|
current -= 1
|
||||||
|
if current == 10:
|
||||||
|
self.play_countdown()
|
||||||
if current > 0:
|
if current > 0:
|
||||||
self.timer_label.configure(text=Util.format_seconds(current))
|
self.timer_label.configure(text=Util.format_seconds(current))
|
||||||
self.timer_check = self.window.after(1000, self.update_timer, 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)
|
image_to_display = ImageTk.PhotoImage(self.current_image)
|
||||||
self.image_label.configure(image=image_to_display)
|
self.image_label.configure(image=image_to_display)
|
||||||
self.image_label.image = image_to_display
|
self.image_label.image = image_to_display
|
||||||
|
|
||||||
|
def play_countdown(self):
|
||||||
|
self.countdown_sound.play()
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
pillow
|
pillow~=9.5.0
|
||||||
pyinstaller
|
pyinstaller
|
||||||
|
pygame~=2.4.0
|
Loading…
Reference in New Issue
Block a user