Prerequisite: Python GUI – tkinter
Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. In this article we will discuss how we can create an average speed calculator using Tkinter.
The idea here is to get time and distance as inputs from the user using tkinter window, then on click of a button the calculated average speed will be displayed to the user.
hours = 10
minutes = 20
distance = 200
Average speed = 19.35
- Import module
- Create object
- Create windows and frames
- Create button to take input values
- Convert minutes into hours, by dividing minutes by 60
- Then add converted hours value into hours
- Divide Total distance value by Total hours value
- Display the value so obtained
- Execute code
Below is the implementation:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course