Skip to main content

PyTimer is a lightweight and easy-to-use Python package designed to provide countdown timer functionality. It offers a simple class-based approach to manage countdowns, making it perfect for various use cases such as timing events, tracking intervals, or managing delays in scripts and applications.

Project description

PyTimer2

PyTimer2 is a simple Python countdown timer package that offers start, pause, resume, and stop functionalities. This tool is perfect for managing timed tasks, creating simple scheduling systems, or integrating into larger applications where precise countdown control is required.

Downloads

Features

  • Start Countdown: Initiate a countdown for a specified duration.
  • Pause Countdown: Pause the countdown at any moment without losing the current time.
  • Resume Countdown: Resume the countdown from where it was paused.
  • Stop Countdown: Completely stop the countdown and reset the timer.
  • Non-Blocking Execution: Runs in a separate thread, allowing your main application to continue running without interruption.

Installation

You can install PyTimer directly from GitHub or from PyPI:

# Install pytimer2
pip install pytimer2

# Usage
from pytimer2 import Timer
import time

# Create a Timer instance
timer = Timer()

# Start the countdown with a duration of 500 seconds
timer.start_countdown(duration=500)

# Access the current countdown value
print(f"Current countdown: {timer.get_countdown()} seconds")

# Let it run for a few seconds and then pause
time.sleep(3)
timer.pause_countdown()
print(f"Countdown paused: {timer.get_countdown()} seconds")

# Wait and then resume the countdown
time.sleep(5)
print(f"Countdown still paused: {timer.get_countdown()} seconds")
timer.resume_countdown()
print("Timer resumed...")

# Run for a few more seconds
time.sleep(2)
print(f"Countdown resumed and current time: {timer.get_countdown()} seconds")

# Stop the countdown
timer.stop_countdown()
print(f"Countdown stopped at: {timer.get_countdown()} seconds")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytimer2-0.2.4.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytimer2-0.2.4-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file pytimer2-0.2.4.tar.gz.

File metadata

  • Download URL: pytimer2-0.2.4.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.12

File hashes

Hashes for pytimer2-0.2.4.tar.gz
Algorithm Hash digest
SHA256 5ed0456051285c03e388b13e46e07c6f372518162b4d77b6d361c9d1a0a87f98
MD5 c01d4953a0ad27b1b9d551df175b1c17
BLAKE2b-256 d67074b1a315c678fcc753a9d3f6ef3f20661f09136ea693cb1372161942fe69

See more details on using hashes here.

File details

Details for the file pytimer2-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: pytimer2-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.12

File hashes

Hashes for pytimer2-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b5c7cb87cac07134b1fcc481a2f051f48daf1b6ef1ddb810dd91c2aa70ca31e6
MD5 e6b54e24d5c17a1589390e0b2a6b58b2
BLAKE2b-256 7f4381a2608e1e8d1844616e80c5b244cdfbff632dcf872959cc469e4bdd828f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page