Skip to content

A real-time analog clock built with Python and pygame. It features dynamically rotating hour, minute, and second hands, complete with labeled hour markings and minute ticks, all rendered using trigonometric calculations for smooth animation.

License

Notifications You must be signed in to change notification settings

64one/analogclock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Analog Clock

A Python-based analog clock simulation built with Pygame. This project renders a customizable analog clock with hour, minute, and second hands that display the current system time. analog_clock

Features

  • Real-time display of the current system time
  • Aesthetic design with distinct hour, minute, and second hands
  • Hour markers with numbers for easy reading
  • Minute markers for precise time interpretation
  • Customizable colors and dimensions
  • Smooth hand movements

Requirements

  • Python 3.x
  • Pygame

Installation

  1. Clone this repository:
git clone https://github.com/64one/analogclock.git
cd analogclock
  1. Install the required packages:
pip install pygame

Usage

Run the program with:

python analog_clock.py

The clock window will appear, displaying the current system time.

Customization

You can easily customize the clock by modifying the following parameters at the top of the script:

  • WIDTH and HEIGHT: Change the size of the clock window
  • CLOCK_RADIUS: Adjust the clock face size
  • Various hand lengths and thicknesses
  • Colors for different clock elements

Controls

  • Close the window to exit the application

How It Works

The program:

  1. Initializes a Pygame window
  2. Draws the clock face with hour and minute markers
  3. Gets the current system time
  4. Calculates the positions of hour, minute, and second hands
  5. Renders the hands on the clock face
  6. Updates the display at regular intervals (30 FPS)

License

This project is licensed under the MIT License.

Author

Martin Chege

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

A real-time analog clock built with Python and pygame. It features dynamically rotating hour, minute, and second hands, complete with labeled hour markings and minute ticks, all rendered using trigonometric calculations for smooth animation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages