✨ Add a countdown #25
							
								
								
									
										
											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 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()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,2 +1,3 @@
 | 
			
		||||
pillow
 | 
			
		||||
pyinstaller
 | 
			
		||||
pillow~=9.5.0
 | 
			
		||||
pyinstaller
 | 
			
		||||
pygame~=2.4.0
 | 
			
		||||
		Reference in New Issue
	
	Block a user