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

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....
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.
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...
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
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
Write a program IN PYTHON of the JUPYTER NOOTBOOK Write a Python program that gets a...
Write a program IN PYTHON of the JUPYTER NOOTBOOK Write a Python program that gets a numeric grade (on a scale of 0-100) from the user and convert it to a letter grade based on the following table. A: 90% - 100% B 80% - 89% C 70% - 79% D 60% - 69% F <60% The program should be written so that if the user entered either a non-numeric input or a numeric input out of the 0-100 range,...
In python make a simple code. You are writing a code for a program that converts...
In python make a simple code. You are writing a code for a program that converts Celsius and Fahrenheit degrees together. The program should first ask the user in which unit they are entering the temperature degree (c or C for Celcius, and f or F for Fahrenheit). Then it should ask for the temperature and call the proper function to do the conversion and display the result in another unit. It should display the result with a proper message....
comments please Your program will calculate the distance an object travels (in meters) on Earth for...
comments please Your program will calculate the distance an object travels (in meters) on Earth for a specified number of seconds. You will also calculate the distance traveled on the Moon (in meters) for the specified number of seconds. Your program must have the main function and, at least, the following four additional functions. The signatures for these functions must be as follows: double readSeconds() double calculateEarthDistance(double seconds) double calculateMoonDistance(double seconds) void displayResults(double seconds, double earthDistance, double moonDistance) The readSeconds...
Using the Python program: a/ Write a program that adds all numbers from 1 to 100...
Using the Python program: a/ Write a program that adds all numbers from 1 to 100 to a list (in order). Then remove the multiples of 3 from the list. Print the remaining values. b/ Write a program that initializes a list with ten random integers from 1 to 100. Then remove the multiples of 3 and 5 from the list. Print the remaining values. Please show your work and explain. Thanks
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT