Skip to content

MiraMadhu/Countdown-timer-app-in-python-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Tkinter Countdown Timer

This project is a simple countdown timer application built using Python's Tkinter library. The timer allows users to input a countdown time in seconds and displays the remaining time in a MM:SS format until it reaches zero and shows the message "Fire in the hole!!".

Table of Contents

Overview

The Tkinter Countdown Timer is a graphical application that provides a countdown timer with a user-friendly interface. Users can enter the desired countdown time in seconds, start the countdown, and watch the timer update every second until it reaches zero.

Installation

To run this project, you need to have Python installed on your system. Follow these steps to set up the project:

  1. Clone the repository or download the source code.
  2. Navigate to the project directory.

Usage

  1. Run the Python script to start the application.
  2. Enter the countdown time in seconds in the input field.
  3. Click the "Start Countdown" button to start the timer.

Code Explanation

Countdown Function

The countdown function takes one parameter t, representing the countdown time in seconds. It checks if t is greater than 0. If it is, the function converts the total seconds into minutes and seconds, formats them into a string MM:SS, and updates the display. The function then schedules itself to run again after 1 second with t decremented by 1. When the countdown reaches zero, it updates the display to show "Fire in the hole!!".

Start Countdown Function

The start_countdown function reads the user input from the entry widget, converts it to an integer, and starts the countdown if the input is valid. If the input is not a valid integer, it catches the ValueError and updates the display to inform the user that the input is invalid.

Creating the GUI

The main window is created using Tkinter. A StringVar is used to hold the time string, and a label is created to display the countdown timer. An entry widget is provided for user input, and a button is created to start the countdown. The Tkinter event loop is started to wait for user interaction.

Contributing

Contributions are welcome! If you have any improvements or suggestions, feel free to open an issue or submit a pull request.

Releases

No releases published

Packages

No packages published

Languages