Ответ:
from tkinter import *
from math import*
root = Tk()
root.title("Задание 2")
root.geometry("550x250")
def summa():
n=EntryN.get()
n=int(n)
a=EntryA.get()
a=int(a)
d=EntryD.get()
d=int(d)
m=EntryM.get()
m=int(m)
s=0
for i in range(1,4):
s+=i + m
pr=1
for j in range(1,4):
pr*=j+d
res=n*(a/pr+s/m)
EntryS.configure(text='y = {}'.format(res))
#EntryS.delete(0,END)
#EntryS.insert(0,res)
Label(root, width=15, text=" n =",font="Times 14").grid(row=1, column=5, sticky=W)
Label(root, width=15, text=" a =",font="Times 14").grid(row=2, column=5, sticky=W)
Label(root, width=15, text=" d =",font="Times 14").grid(row=3, column=5, sticky=W)
Label(root, width=15, text=" m =",font="Times 14").grid(row=4, column=5, sticky=W)
EntryN = Entry(root, width=15, font="Times 14")
EntryA = Entry(root, width=15, font="Times 14")
EntryD = Entry(root, width=15, font="Times 14")
EntryM = Entry(root, width=15, font="Times 14")
#EntryS = Entry(root, width=25, font="Times 14")
EntryS = Label(root)
EntryS.grid(column=5, row=5)
EntryN.grid(row=1, column=6, sticky=E)
EntryA.grid(row=2, column=6, sticky=E)
EntryD.grid(row=3, column=6, sticky=E)
EntryM.grid(row=4, column=6, sticky=E)
# файл с формулой, если отличается - укажите свой
img = PhotoImage(file="d:/f1.gif")
label = Label(root, image=img)
label.image_ref = img
label.grid(column=9, row=0)
but = Button(root, text="Вывести сумму", width=20, font="Times 10", command=summa)
but.grid(row=5, column=9, sticky=E)
root.mainloop()
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
from tkinter import *
from math import*
root = Tk()
root.title("Задание 2")
root.geometry("550x250")
def summa():
n=EntryN.get()
n=int(n)
a=EntryA.get()
a=int(a)
d=EntryD.get()
d=int(d)
m=EntryM.get()
m=int(m)
s=0
for i in range(1,4):
s+=i + m
pr=1
for j in range(1,4):
pr*=j+d
res=n*(a/pr+s/m)
EntryS.configure(text='y = {}'.format(res))
#EntryS.delete(0,END)
#EntryS.insert(0,res)
Label(root, width=15, text=" n =",font="Times 14").grid(row=1, column=5, sticky=W)
Label(root, width=15, text=" a =",font="Times 14").grid(row=2, column=5, sticky=W)
Label(root, width=15, text=" d =",font="Times 14").grid(row=3, column=5, sticky=W)
Label(root, width=15, text=" m =",font="Times 14").grid(row=4, column=5, sticky=W)
EntryN = Entry(root, width=15, font="Times 14")
EntryA = Entry(root, width=15, font="Times 14")
EntryD = Entry(root, width=15, font="Times 14")
EntryM = Entry(root, width=15, font="Times 14")
#EntryS = Entry(root, width=25, font="Times 14")
EntryS = Label(root)
EntryS.grid(column=5, row=5)
EntryN.grid(row=1, column=6, sticky=E)
EntryA.grid(row=2, column=6, sticky=E)
EntryD.grid(row=3, column=6, sticky=E)
EntryM.grid(row=4, column=6, sticky=E)
# файл с формулой, если отличается - укажите свой
img = PhotoImage(file="d:/f1.gif")
label = Label(root, image=img)
label.image_ref = img
label.grid(column=9, row=0)
but = Button(root, text="Вывести сумму", width=20, font="Times 10", command=summa)
but.grid(row=5, column=9, sticky=E)
root.mainloop()