Вопрос задан 16.06.2023 в 13:54. Предмет Информатика. Спрашивает Пашнина Анна.

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

0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Пищаев Глеб.

Ответ:

n=input()

a=str(n)

b=a[:-3]

print(int(b)*1000,'м/с')

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

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.

0 0

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

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

Последние заданные вопросы в категории Информатика

Задать вопрос