This is a simple Tabata Timer I created for personal use. Feel free to use it as well. The application uses the nicegui
library for creating a graphical user interface (GUI) and asyncio
for handling asynchronous operations.
- Python 3.11
- nicegui library
- Make sure you have Python 3.11 installed on your system.
- Install the nicegui library by running the following command:
pip install nicegui
- Copy the code from this repository into your Python file.
- Run the Python file containing the code.
- The Tabata Timer application will open in a new window.
- Set the desired values for work time, rest time, and rounds using the input fields.
- Click the "Start" button to start the timer.
- The timer will display the minutes, seconds, and milliseconds remaining for each interval.
- The timer will automatically transition between work and rest intervals according to the specified times and number of rounds.
- Click the "Stop" button to stop the timer.
- To restart the timer with new settings, update the input fields and click "Start" again.
The code uses the asyncio
library for handling asynchronous operations, allowing the timer to run without blocking the GUI.
The reset
function is responsible for resetting the timer labels and round counter.
The countdown
function is used to update the timer labels during each interval. It also plays audio files at specific times using the ui.audio
function.
The main
function is the main logic of the timer. It starts or stops the timer based on the current state of the "Start" button. It iterates through the specified number of rounds and calls the countdown
function for each work and rest interval.
The code also includes the necessary GUI components for displaying the timer labels, input fields for setting the timer values, and the "Start" button.
- You can modify the default values for work time, rest time, and rounds by changing the
value
attribute of the corresponding input fields. - Customize the GUI layout and styling by modifying the styles applied to the UI components.
- Replace the audio files with your own by specifying the file paths in the
ui.audio
function calls.
Feel free to modify the code according to your requirements and preferences.
Note: Make sure to credit the nicegui
library if you include this code or modified versions of it in your projects.