from Tkinter import *
from matplotlib import *
import matplotlib.pyplot as plt
from numpy import *
m=input('massa puli v "KG"' )
a=input('ygol naklona' )
k=input('koficent jostkosti prujiny v "H/M"' )
l1=input('dlina prujiny v svobodnom sostoynii v "m"' )
l2=input('dlina prujiny v diformirovonom sostoynii v "m"' )
k1=input('koficent sopratevleniy sredy pri malyx skorostyx' )
k2=input('koficent sopratevleniy sredy pri bolshix skorostyx' )
class But_print:
def __init__(self):
self.but = Button(root)
self.but["text"] = "calculite"
self.but.bind("<Button-1>",self.printer)
self.but.pack()
def printer(self,event):
v=(l1-l2)*((k/m)**0.5)
vx0=v*math.cos((a*pi)/180)
vy0=v*math.sin((a*pi)/180)
x0=0.0
y0=0.0
dt=0.0001
g=9.8
vx0=int(vx0)
x=[x0]
vx=[vx0]
vy=[vy0]
y=[y0]
i=0
while y[i]>=0:
if (vx[i]**2+vy[i]**2)**0.5>70:
ri=vx[i]-((k1+k2(vx[i]**2+vy[i]**2)**0.5)*vx[i]/m)*dt
vx.append(ri)
f=vy[i]-(g+(k1+k2(vx[i]**2+vy[i]**2)**0.5)*vy[i]/m)*dt
vy.append(f)
d=x[i]+vx[i]*dt
x.append(d)
r=y[i]+vy[i]*dt
y.append(r)
else:
z=vx[i]-(k1/m*vx[i])*dt
vx.append(z)
f=vy[i]-(k1/m*vy[i]+g)*dt
vy.append(f)
d=x[i]+vx[i]*dt
x.append(d)
r=y[i]+vy[i]*dt
y.append(r)
i=i+1
w=max(y)
o=x[i]
plt.plot(x,y)
plt.xlabel('x')
plt.ylabel('y')
o=x[i]
plt.axis([0, x[i]+2, 0, w+2])
plt.legend([('xmax=',o,
'ymax =', w)],
loc='upper left')
e1=(m*v*v)/2
e2=(m*((vx[i]**2+vy[i]**2)**0.5))/2
de=e2-e1
print ("energiy v nachale poleta=",e1)
print ("energiy v konze poleta=",e2)
print ("rabota sil soprativleniy vozdyxa=",de)
plt.show()
root = Tk()
obj = But_print()
root.mainloop()
то выдаёт ошибку:
Exception in Tkinter callback
Traceback (most recent call last):
File “C:\Python26\lib\lib-tk\Tkinter.py”, line 1410, in __call__
return self.func(*args)
File “C:\Documents and Settings\vell\Рабочий стол\projekt.py”, line 39, in printer
ri=vx-((k1+k2(vx**2+vy**2)**0.5)*vx/m)*dt
TypeError: ‘float’ object is not callable
помогите исправить очень срочно надо !!)) зарание благодарю