#ПреобразованиеКилометровВМилиНаPython
Код из видео:
from tkinter import *
def convert():
km = float(e.get())
miles = 0.621371
miles = km * miles
converted['text'] = miles
root = Tk()
root.title('Конвертер километров в мили')
root.resizable(width=False, height=False)
root.geometry('400x250')
root['bg'] = 'black'
lb = Label(root, text='Введите число километров: ', font='Arial 12 bold', fg='lime', bg='black')
lb.pack(pady=10)
e = Entry(root, font='Arial 16 bold')
e.pack(pady=10)
btn = Button(root, text='Перевести в мили', font='Arial 10 bold', pady=5, padx=5, command=convert)
btn.pack(pady=10)
lb2 = Label(root, text='Расстояние в милях: ', font='Arial 12 bold', fg='lime', bg='black')
lb2.pack(pady=10)
converted = Label(root, text='', font='Arial 25 bold', bg='black', fg='lime')
converted.pack()
root.mainloop()
Код из видео:
from tkinter import *
def convert():
km = float(e.get())
miles = 0.621371
miles = km * miles
converted['text'] = miles
root = Tk()
root.title('Конвертер километров в мили')
root.resizable(width=False, height=False)
root.geometry('400x250')
root['bg'] = 'black'
lb = Label(root, text='Введите число километров: ', font='Arial 12 bold', fg='lime', bg='black')
lb.pack(pady=10)
e = Entry(root, font='Arial 16 bold')
e.pack(pady=10)
btn = Button(root, text='Перевести в мили', font='Arial 10 bold', pady=5, padx=5, command=convert)
btn.pack(pady=10)
lb2 = Label(root, text='Расстояние в милях: ', font='Arial 12 bold', fg='lime', bg='black')
lb2.pack(pady=10)
converted = Label(root, text='', font='Arial 25 bold', bg='black', fg='lime')
converted.pack()
root.mainloop()