Ответ:
from tkinter import *
def calculate():
a = float(entry_a.get())
b = float(entry_b.get())
c = float(entry_c.get())
result = a + b + c
label_result.config(text="Результат: " + str(result))
root = Tk()
root.title("Калькулятор")
label_a = Label(root, text="a=")
label_a.pack()
entry_a = Entry(root)
entry_a.pack()
label_b = Label(root, text="b=")
label_b.pack()
entry_b = Entry(root)
entry_b.pack()
label_c = Label(root, text="c=")
label_c.pack()
entry_c = Entry(root)
entry_c.pack()
button_calc = Button(root, text="Показать Результат", command=calculate)
button_calc.pack()
label_result = Label(root, text="")
label_result.pack()
root.mainloop()
Объяснение:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
from tkinter import *
def calculate():
a = float(entry_a.get())
b = float(entry_b.get())
c = float(entry_c.get())
result = a + b + c
label_result.config(text="Результат: " + str(result))
root = Tk()
root.title("Калькулятор")
label_a = Label(root, text="a=")
label_a.pack()
entry_a = Entry(root)
entry_a.pack()
label_b = Label(root, text="b=")
label_b.pack()
entry_b = Entry(root)
entry_b.pack()
label_c = Label(root, text="c=")
label_c.pack()
entry_c = Entry(root)
entry_c.pack()
button_calc = Button(root, text="Показать Результат", command=calculate)
button_calc.pack()
label_result = Label(root, text="")
label_result.pack()
root.mainloop()
Объяснение: