Topic: Python 3 Pounds to Kilogram Converter GUI tkinter Program
How to Convert Pounds to Kilograms
We use pounds (lbs) and kilograms (kg) as units to measure weight or mass. Both are used in different parts of the world as a weight or mass unit. Therefore, often we need to covert the Pounds to Kilograms or vice versa.
Here is the formula to convert Pounds to Kg
Since we know thtat, 1 Pound is equal to 0.454 Kilograms
or we say 1 Kilogram is equal to 2.2046 Pounds.
We can easily convert Pounds into Kgs by Dividing the number of pounds by 2.2046,
the formula is:
Kg = pounds / 2.2046
Python Pounds to Kilogram Converter GUI Program
- This program uses 5 Label widgets to display text in the program window
- The user will input the value of pounds in an entry widget.
- He / she will click on a button to for Lbs to Kg conversion and getting the result.
- The convetred result will be printed on a label
- Note that the formula of coversion of Pounds into Kilograms is as follows:
- Kg = pounds / 2.2046 (divide pounds by 2.2046)
First of all we import * from tkinter module
main() function definition
The very first line is used to create the main window of this gui program.
Set the title of the main window.
Set the size and position of the main window.
Create necessary widgets to develop the GUI of the program
Place these widgets in the main window properly
Attach the functional code with the click event of the button widget.
Therefore, the user will input pounds in the text box and will click on the button.
The conversion from pounds to KG will take place and the answer will be shown on the label control.
Python Pounds to Kilogram Converter GUI
You may also like:
945 total views, 3 views today