
Python Tkinter Вводится скорость в км/ч, получаем скорость в м/с;


Ответы на вопрос

Ответ:
n=input()
a=str(n)
b=a[:-3]
print(int(b)*1000,'м/с')



Converting Speed from km/h to m/s using Python Tkinter
To convert speed from kilometers per hour (km/h) to meters per second (m/s) using Python Tkinter, you can create a simple graphical user interface (GUI) application. Here's a basic example of how you can achieve this:
```python import tkinter as tk
def convert_speed(): kmh = float(entry.get()) ms = kmh * (1000 / 3600) result_label.config(text=f"{kmh} km/h = {ms} m/s")
# Create the main window root = tk.Tk() root.title("Speed Converter")
# Create input entry entry = tk.Entry(root, width=10) entry.pack(pady=10)
# Create a button to trigger the conversion convert_button = tk.Button(root, text="Convert", command=convert_speed) convert_button.pack()
# Create a label to display the result result_label = tk.Label(root, text="") result_label.pack(pady=10)
# Run the application root.mainloop() ```
In this example, we use the `tkinter` module to create a simple GUI with an input field for the user to enter the speed in km/h. When the "Convert" button is clicked, the `convert_speed` function is called, which calculates the speed in m/s and displays the result.
Note: This is a basic example to demonstrate the concept. You can further enhance the GUI and add error handling as needed.
I hope this helps! Let me know if you have further questions or need additional assistance.


Похожие вопросы

Топ вопросов за вчера в категории Информатика







Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili