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.
- 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
- Python 3.x
- Pygame
- Clone this repository:
git clone https://github.com/64one/analogclock.git
cd analogclock
- Install the required packages:
pip install pygame
Run the program with:
python analog_clock.py
The clock window will appear, displaying the current system time.
You can easily customize the clock by modifying the following parameters at the top of the script:
WIDTH
andHEIGHT
: Change the size of the clock windowCLOCK_RADIUS
: Adjust the clock face size- Various hand lengths and thicknesses
- Colors for different clock elements
- Close the window to exit the application
The program:
- Initializes a Pygame window
- Draws the clock face with hour and minute markers
- Gets the current system time
- Calculates the positions of hour, minute, and second hands
- Renders the hands on the clock face
- Updates the display at regular intervals (30 FPS)
This project is licensed under the MIT License.
Martin Chege
Contributions are welcome! Please feel free to submit a Pull Request.