I addressed issues with the same problem and the solution was mainly in .set ()
.
I am a novice, I did the same and I did not succeed. Please help understand and point out the error.
I do so that in dp1o
the value changes according to the formula xmax, but it seems that the calculation occurs only for an automatically assigned zero.
from math import *
from tkinter import *
root = Tk()
f_top = Frame(root)
root.title('Полет ядра')
g = 9.81
dx = 0.01
v = IntVar()
an = IntVar()
t = IntVar()
vx = IntVar()
def analysis():
v = int(entry1.get())
an = int(entry2.get())
t = (((2 * v * sin(an)) / g))
vx = v * cos(an)
xmax = vx * t * cos(an)
dp1o.config(text=xmax)
first = LabelFrame(root, text='Данные для первого графика')
first.pack(side='left')
second = Label(first, text='Начальная скорость')
second.pack()
entry1 = Entry(first, width=10, textvariable=v)
entry1.pack()
third = Label(first, text='Угол выстрела')
third.pack()
entry2 = Entry(first, width=10, textvariable=an)
entry2.pack()
first = LabelFrame(root, text='Расчет')
first.pack(side='right')
dp1 = Label(first, text='Дальность полета 1 тела')
dp1.pack()
dp1o = Label(first, text='')
dp1o.pack()
button = Button(root, text="Сгенерировать", command=analysis())
button.pack(side='left')
root.mainloop()