A simple and elegant digital clock application built with Python and tkinter.
A simple and elegant digital clock application built with Python and tkinter. This application displays the current time and date in a clean, easy-to-read format with a modern dark theme interface.
- Real-time clock display (HH:MM:SS format)
- Current date display
- Dark mode interface
- Auto-updating every second
- Clean and minimalist design
- Resizable window
Before running this application, make sure you have:
- Python 3.x installed
- tkinter library (usually comes with Python installation)
- Clone the repository or download the files:
git clone https://github.com/yourusername/digital-clock.git- Navigate to the project directory:
cd digital-clock- No additional packages need to be installed as the project uses only standard Python libraries.
- Run the application using Python:
python digital_clock.py-
The clock will automatically start and display the current time and date.
-
To close the application, simply click the window's close button (X).
You can customize the clock by modifying these values in the code:
self.window.geometry("400x200") # Change dimensions (width x height)self.window.configure(bg='black') # Change background color
foreground='cyan' # Change text colorfont=('Arial', 50, 'bold') # Change font family, size, and styledigital_clock/
│
├── digital_clock.py # Main application file
└── README.md # Documentation
The application consists of three main components:
- Window Setup: Creates the main application window using tkinter
- Time Display: Shows the current time in HH:MM:SS format
- Date Display: Shows the current date in Month DD, YYYY format
The clock updates every second using tkinter's after() method, which schedules the update function to run every 1000 milliseconds (1 second).
-
Window doesn't appear
- Make sure you have Python installed correctly
- Verify tkinter is installed with your Python distribution
-
Clock shows wrong time
- The clock uses your system time, ensure your system time is set correctly
Feel free to fork this project and submit pull requests. You can also open issues for bugs or feature requests.
Suggested areas for contribution:
- Adding alarm functionality
- Implementing different time zones
- Adding themes/color schemes
- Creating a 12-hour time format option
This project is released under the MIT License. Feel free to use it for personal or commercial projects.
Mahmoud Eltayeb