while True:
left.origin.x = xleft
right.origin.x = xright
xleft += dx
xright -= dx
if xleft > 0:
xleft -= lamb
if xright < -lamb:
xright += lamb
i = 0
for x in arange(0,10*lamb+3*dx/2,dx):
yleft = yright = 0
if x < xleft+12*lamb:
yleft = left.point(int(round((x-xleft)/dx))).pos.y
if x > xright:
yright = right.point(int(round((x-xright)/dx))).pos.y
wave.modify(i, y=yleft+yright)
i += 1
rate(100)
When run in either Jupyter Notebook, or PyCharm,
using vpython ver: 7.6.4,
both "/dx))).pos.y" calls were found to produce the following errors:
Traceback (most recent call last):
File "H:/Py-Lessons/VPython_StandingWave.py", line 84, in <module>
yleft = left.point(int(round((x - xleft) / dx))).pos.y
AttributeError: 'dict' object has no attribute 'pos'