when I dealing with chapter 6 to solve PDE, I face a problem in python 3.
class line:
""" create a line by connecting points x[], y[], z[].
optionally, specify line color and thickness """
def __init__(self, x, y, z, linecolor=(1,1,1), thick = .05):
self.line = vp.curve(color=linecolor, radius=thick)
self.move(x, y, z)
def move(self, x, y, z): # update line
self.line.pos = np.column_stack((x, y, z))
Below is the error info. :
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-12-2c6b16e40197> in <module>()
----> 1 string = line(x, u0, z, vp.vector(1,1,1),0.05)
<ipython-input-8-308e4cbb654b> in __init__(self, x, y, z, linecolor, thick)
4 def __init__(self, x, y, z, linecolor=(1,1,1), thick = .05):
5 self.line = vp.curve(color=linecolor, radius=thick)
----> 6 self.move(x, y, z)
7
8 def move(self, x, y, z): # update line
<ipython-input-8-308e4cbb654b> in move(self, x, y, z)
7
8 def move(self, x, y, z): # update line
----> 9 self.line.pos = np.column_stack((x, y, z))
~\Anaconda3\lib\site-packages\vpython\vpython.py in pos(self, val)
1940 @pos.setter
1941 def pos(self,val):
-> 1942 raise AttributeError('use object methods to change its shape')
1943
1944 # def __del__(self):
AttributeError: use object methods to change its shape
Anyone could help figure the problem? I'm new to python. Thanks in advance!