A Python-based countdown timer built using Pygame and Tkinter. This application allows users to adjust the timer, import sound files (.mp3
or .wav
), and play a sound when the timer reaches 30 seconds. The interface is user-friendly and includes buttons to start, stop, increase, decrease, and reset the timer.
- Click the link to read Instructions.
- Adjustable countdown timer with a default duration of 60 seconds.
- Import sound files (
.mp3
or.wav
) to play when the timer reaches 30 seconds. - Simple, user-friendly interface built with Pygame.
- Buttons to start, stop, increase, decrease, and reset the timer.
- Python 3.11+
- Pygame
- Tkinter (usually comes pre-installed with Python on most systems)
- YOU ONLY NEED ONE VERSION OF PYTHON TO RUN THIS!!
.
βββ .github/ # GitHub issue templates
βββ OpenSource-Sounds-For-Countdown-Timer/ # Directory for countdown sounds
βββ image/ # Directory for images
βββ CODE_OF_CONDUCT.md # Code of Conduct for the project
βββ CONTRIBUTING.md # Guidelines for contributing
βββ LICENSE # License information
βββ SECURITY.md # Security policy
βββ Sounds.txt # List or details about sound files
βββ install_dep.bat # Batch script to install dependencies
βββ main-launcher.bat # Main batch script to launch the program
βββ main.py # Main Python file for your program
βββ config.py # Configuration settings
βββ readme.md # Main project documentation (README)
βββ requirements.txt # Python dependencies
βββ timer-list.md # Information about available timers
- Clone the repository:
git clone https://github.com/KernFerm/countdown-timer-obs.git
cd countdown-timer-obs
- Install dependencies: Install the required dependencies using pip:
pip install pygame
pip install tk
- Run the script: Once dependencies are installed, run the script using Python:
python main.py
- Adjust Timer: Use the
+10 sec
and-10 sec
buttons to increase or decrease the countdown time. - Start/Stop Timer: Use the
Start
button to start the countdown, and theStop
button to pause it. - Import Sound: Use the
Import Sound
button to select a.mp3
or.wav
file that will play when the timer reaches 30 seconds. - Clear Timer: Use the
Clear Timer
button to reset the timer to 60 seconds.
When running the script, the interface will display:
- A countdown timer.
- Buttons to adjust the timer, start/stop it, import a sound, and reset the timer.
- Information about the selected sound file.
Button | Description |
---|---|
+10 sec | Increases the countdown timer by 10 sec |
-10 sec | Decreases the countdown timer by 10 sec |
Start | Starts the countdown timer |
Stop | Pauses the countdown timer |
Import Sound | Imports a .mp3 or .wav sound file |
Clear Timer | Resets the timer to 60 seconds |
- The countdown timer updates every second. You can increase or decrease the time using the buttons:
# Increase the timer by 10 seconds
duration += 10
# Decrease the timer by 10 seconds, ensuring it doesn't go below 0
duration = max(0, duration - 10)
You can import .mp3
or .wav
files. The sound will play when the timer reaches 30 seconds:
selected_file = filedialog.askopenfilename(
title="Select Sound File",
filetypes=AUDIO_FILE_TYPES
)
- If the selected sound file's duration is longer than 2 minutes, an error message will appear:
if duration > 120:
messagebox.showerror("Invalid File", "The file exceeds 2 minutes.")
- Here are the configuration settings used in the program:
# Configurations for Countdown Timer Application
# Timer settings
ALERT_DURATION = 30 # When to play sound (in seconds)
# Sound settings
SOUND_VOLUME = 0.26
# File dialog settings
AUDIO_FILE_TYPES = [("Audio Files", "*.mp3 *.wav")]
# Frame settings
FPS = 30 # Frames per second for the Pygame clock
-
We welcome contributions!
-
Please read our
Contributing Guidelines
andCode of Conduct
before making a pull request.