In this article we will see how we can create a stop watch using Python GUI – PyQt5.
A stopwatch is a handheld timepiece designed to measure the amount of time that elapses between its activation and deactivation. A large digital version of a stopwatch designed for viewing at a distance, as in a sports stadium, is called a Stopclock.
Steps to create a stop watch –
1. Create a counter which signify the seconds
2. Create flag to know when to start and when to pause, set it to False
3. Create label to show seconds
4. Create three push button for starting the stop watch pausing the stop watch and for re-setting the stop watch
5. Add action to each push button.
6. Inside start push button action make flag to true
7. Inside pause push button action make flag to false
8. Inside reset push button action make flag to false and make the counter value to 0
9. Create QTimer object which calls a method after every 100 millisecond i.e 10th part of second
10. Inside QTimer object method check for the flag status if it is true increment the counter
11. Show the counter value through label using setText method.
Below is the implementation –
- Create a stopwatch using python
- Python | Create a stopwatch using clock object in kivy using .kv file
- Python | Create a stopwatch Using Clock Object in kivy
- PyQt5 - Create a digital clock
- Python | Create a digital clock using Tkinter
- RSA Digital Signature Scheme using Python
- Create digital clock using Python-Turtle
- PyQt5 - Bbackground image to lineedit part of ComboBox when mouse hover
- PyQt5 - Background image to lineedit part of non-editable ComboBox when mouse hover
- PyQt5 QSpinBox – Setting object name
- PyQt5 QSpinBox – Showing it on lower level
- PyQt5 QCalendarWidget - Setting Border to the tool buttons
- PyQt5 QCalendarWidget - Clicked signal
- PyQt5 QCalendarWidget - Removing memory reference
- PyQt5 QCalendarWidget - Setting Border to the months menu
- PyQt5 - Getting the role of selected item in ComboBox
- PyQt5 ComboBox - User entered items store at top
- PyQt5 ComboBox – User entered items not stored in drop down menu
- PyQt5 - How make duplicates insertions in ComboBox
- PyQt5 - Checking if the duplicate values are allowed or not in ComboBox
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.