hello, everyone
When I try to access the pos attribute of the points object, the code throws an exception. What could be causing this issue, and how should I properly access and modify the pos attribute of the points object?
from vpython import *
# first set of points
a=points(pos=[vector(-1, 0, 0),
vector(1, 0, 0),
vector(0, 1, 0),
vector(0, -1, 0)],
color=vector(1, 0, 0),
radius=10)
print(a.pos)
while True:
rate(100)
here is the exception when i run the code
Traceback (most recent call last):
File "F:\pythonProject\wave_test.py", line 10, in <module>
print(a.pos)
File "C:\Program Files (x86)\anaconda\lib\site-packages\vpython\vpython.py", line 2047, in pos
raise AttributeError('object does not have a "pos" attribute')
AttributeError: object does not have a "pos" attribute
Also, when I run the following code, the program encounters an error as well
points_list = []
field = [[[0 for _ in range(3)] for _ in range(Xsize + 1)] for _ in range(Xsize + 1)]
for i in range(Xsize + 1):
for j in range(Xsize + 1):
points_list.append(vector(i*dx, j*dx, field[i][j][0]))
the exception is
Traceback (most recent call last):
File "F:\pythonProject\wave.py", line 122, in <module>
wave_points = points(pos=points_list, size=2, color=color.blue)
File "C:\Program Files (x86)\anaconda\lib\site-packages\vpython\vpython.py", line 2093, in __init__
super(curveMethods, self).setup(args)
File "C:\Program Files (x86)\anaconda\lib\site-packages\vpython\vpython.py", line 723, in setup
setattr(self, key, value)
File "C:\Program Files (x86)\anaconda\lib\site-packages\vpython\vpython.py", line 817, in size
if value.x == 0:
AttributeError: 'int' object has no attribute 'x'