Question

In: Computer Science

Using Python Write a GUI program that converts a distance in Meters to the equivalent distance...

Using Python

Write a GUI program that converts a distance in Meters to the equivalent distance in Feet. The user should be able to enter a distance in Meters, click a button, and then see the equivalent distance in feet. Use the following formula to make the conversion:

Meters = Feet x 0.304

For example, 1 Meter is 3.28 Feet.

Solutions

Expert Solution

Solution: Python 3


import tkinter as tk

window = tk.Tk()
window.geometry("300x150")
window.title("Converter")

def convert():
    meters = float(input_meter.get())
    feets = meters / 0.304
    output_feet.insert(0,'%.3f'%feets)
    return

Meters = tk.Label(window, text="Enter Meters :", width=12, font=("arial",10,"bold"))
Meters.place(x=5, y=20)
input_meter = tk.Entry(window, width=15)
input_meter.place(x=105,y=20)
unit1 = tk.Label(window, text="Meters", width=6, font=("arial",10,"bold"))
unit1.place(x=150, y=20)

Feets = tk.Label(window, text="Result:", width=7, font=("arial",10,"bold"))
Feets.place(x=5, y=85)
output_feet = tk.Entry(window, width=15)
output_feet.place(x=105,y=85)
unit2 = tk.Label(window, text="Feets", width=6, font=("arial",10,"bold"))
unit2.place(x=150, y=85)

button = tk.Button(window, text="Convert", width=12, bg="brown", fg="white", command=convert)
button.place(x= 100, y=50)

window.mainloop()

OUTPUT


Related Solutions

Write a C++ program, falling.cpp, that inputs a distance in meters from the user and computes...
Write a C++ program, falling.cpp, that inputs a distance in meters from the user and computes the amount of time for the object falling from that distance to hit the ground and the velocity of the object just before impact. Air resistance is discounted (assumed to fall in a vacuum). To compute the time, use the formula: t = Square Root (2d / g) where d is the distance in meters and g is the acceleration due to gravity on...
Using Tkinter for GUI, A Python program that will allow the user to perform (i) generate...
Using Tkinter for GUI, A Python program that will allow the user to perform (i) generate RSA keys, (ii) encrypt a given message and (iii) decrypt the message without using any cryptographic library. Your program will generate the values of p unless the user provides them manually. Then the program will generate the keys (private and public). Then the program will allow the user to enter his/her message to be encrypted. Finally, the program will perform the decryption operation as...
Write a GUI based Python program that will allow the user to perform (i) generate RSA...
Write a GUI based Python program that will allow the user to perform (i) generate RSA keys, (ii) encrypt a given message and (iii) decrypt the message without using any cryptographic library. Your program will generate the values of p unless the user provides them manually. Then the program will generate the keys (private and public). Then the program will allow the user to enter his/her message to be encrypted. Finally, the program will perform the decryption operation as well....
Use Visual Python or equivalent, to write a program that allows the user to observe the...
Use Visual Python or equivalent, to write a program that allows the user to observe the following: Damped and forced harmonic oscillators. The program should be user friendly and have default values for the initial velocities, positions, masses, and spring constants as well as damping constants. Values and frequencies for the forced oscillators should also be given. It should allow the user to input values for the velocities, positions, spring constants, and masses. The program should determine automatically the scale...
Language Python with functions and one main function Write a program that converts a color image...
Language Python with functions and one main function Write a program that converts a color image to grayscale. The user supplies the name of a file containing a GIF or PPM image, and the program loads the image and displays the file. At the click of the mouse, the program converts the image to grayscale. The user is then prompted for a file name to store the grayscale image in.
Using java.util.Stack and java.util.StringTokenizer to write a program that converts an infix expression to a postfix...
Using java.util.Stack and java.util.StringTokenizer to write a program that converts an infix expression to a postfix expression using data from infix.dat. Make sure your program can handle negative number. If the input expression can’t be converted, display error message.(1.5 points) (Should remove parentheses) infix.dat 5 * 6 + -10 3 - 2 + 4 7 ( 3 * 4 - (2 + 5)) * 4 / 2 10 + 6 * 11 -(3 * 2 + 14) / 2 2...
Using a (GUI interface), write a Java program that simulates an ATM machine with the following...
Using a (GUI interface), write a Java program that simulates an ATM machine with the following options menu: "Welcome" 1. Deposit to account 2. Withdraw 3. Exit
using C program Assignment Write a computer program that converts a time provided in hours, minutes,...
using C program Assignment Write a computer program that converts a time provided in hours, minutes, and seconds to seconds Functional requirements Input MUST be specified in hours, minutes, and seconds MUST produce the same output as listed below in the sample run MUST correctly compute times Nonfunctional requirements MUST adhere to program template include below MUST compile without warnings and errors MUST follow the code template provided in this assignment MUST NOT change " int main() " function MUST...
using C program Assignment Write a computer program that converts a time provided in hours, minutes,...
using C program Assignment Write a computer program that converts a time provided in hours, minutes, and seconds to seconds Functional requirements Input MUST be specified in hours, minutes, and seconds MUST produce the same output as listed below in the sample run MUST correctly compute times Nonfunctional requirements MUST adhere to program template include below MUST compile without warnings and errors MUST follow the code template provided in this assignment MUST NOT change " int main() " function MUST...
In python. Write a program that takes 2 string inputs and calculates the Hamming Distance. Hamming...
In python. Write a program that takes 2 string inputs and calculates the Hamming Distance. Hamming distance between two strings is the number of positions at which the corresponding symbols are different. The program should output an integer representing this distance. For example a = XXWWZZ b = ZZWWXX answer = 4 More examples: "Phone" and "PHOONE" = 3 "God" and "Dog" = 2 "Dog" and "House" = 4
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT