Skip to content

⏱️ A PyQt5 stopwatch app with real-time clock, custom 7-segment-style font, and dynamic UI. Includes start/stop/reset controls, hover effects, and precise 10ms updates.

Notifications You must be signed in to change notification settings

fgatto13/PythonStopWatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 PythonStopWatch ⏱️

🖼 App Preview

Here you can see what the app looks like:

Screen1

And here are a couple of screenshots to show how the app behaves based on the operation performed:

This project is a stopwatch application built with PyQt5, combining a real-time digital clock with a start/stop/reset timer. It features a custom 7-segment-style font, dynamic styling, and a clean, interactive interface.


🚀 Features

  • ✅ Stopwatch with Start / Stop / Reset functionality
  • ✅ Real-time digital clock displayed at the top
  • ✅ Updates every 10 milliseconds
  • ✅ Custom font (DS-DIGIT.TTF) loaded safely with fallback
  • ✅ Clean UI with bold styling and hover effects
  • ✅ Custom cursor for buttons
  • ✅ Button states change dynamically (e.g., disable Start after press)
  • ✅ Designed for modularity and clarity using multiple classes

🗂 Project Structure

PythonStopwatch/
├── main.py              # Entry point – initializes and runs the app
├── stopwatch.py         # Main widget – stopwatch UI and logic
├── digitalClock.py      # Reused digital clock widget with real-time display
├── fonts/
│   └── ds_digital/
│       └── DS-DIGIT.TTF # Custom digital-style font

🎨 Styling

The app uses Qt Style Sheets (QSS) within Python to style:

  • Labels and buttons with rounded borders
  • Button hover states
  • Font sizes and background colors

Buttons are enhanced with a pointing hand cursor to signal interactivity.


🧠 How It Works

  • The stopwatch uses QTime and QTimer to track elapsed time in 10ms intervals.
  • The digital clock updates every second using its own QTimer.
  • Time is formatted consistently using f"{val:02}" specifiers to ensure fixed-width layout.
  • The custom font is loaded using QFontDatabase.addApplicationFont(...) with safe fallbacks and exception handling.
  • Font path detection adapts for PyInstaller or .app bundle usage.

▶️ Running the App

pip install PyQt5
python main.py

💾 Font Loading

The stopwatch uses a custom font stored at:

fonts/ds_digital/DS-DIGIT.TTF

It is loaded programmatically and safely handled in case the file is missing or fails to register.


🧑‍💻 Author

Built by @fgatto13
This project reflects applied concepts of custom font handling, time management, event-driven programming, and clean UI design in PyQt5.

🙏 Credits & Acknowledgments

This project is based on a PyQt5 digital stopwatch tutorial originally created by BroCode.

The original tutorial served as a foundation for building a simple stopwatch GUI.

This version adds:

  • event handling of the various buttons (enabled/disabled dynamically)
  • dynamic changes based on events for the text
  • a custom font
  • reuse of another custom widget (digital clock)

About

⏱️ A PyQt5 stopwatch app with real-time clock, custom 7-segment-style font, and dynamic UI. Includes start/stop/reset controls, hover effects, and precise 10ms updates.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages