【1】首先,VPython7要求,一切的数组变量【坐标等】必须写成VECTOR(x,y,z)形式,否则报错。
【2】其次,部分函数是不可用的:
a)frame()本意为构建窗口,但在新版本中被禁用,只要使用就会raise一个Error
Traceback (most recent call last):
File "C:\Users\*****\Desktop\MEME\vpython\__init__.py", line 2, in <module>
frame()
File "C:\Users\86158\AppData\Local\Programs\Python\Python39\lib\site-packages\vpython\vpython.py", line 2680, in __init__
raise NameError('frame is not yet implemented')
NameError: frame is not yet implemented
点进去一看源码,行了,啥都明白了:
class frame(object):
def __init__(self, **args):
raise NameError('frame is not yet implemented')
!!!本来以为是语法不对,结果来了一句这个
b)faces()本意为构建多面体,同样,会raiseError:
Traceback (most recent call last):
File "C:\Users\86158\Desktop\MEME\cv\__init__.py", line 2, in <module>
faces()
File "C:\Users\86158\AppData\Local\Programs\Python\Python39\lib\site-packages\vpython\vpython.py", line 2523, in __init__
raise NameError('faces is no longer supported; use vertex with triangle or quad')
NameError: faces is no longer supported; use vertex with triangle or quad
同样,
class faces(object):
def __init__(self, **args):
raise NameError('faces is no longer supported; use vertex with triangle or quad')
---可以改成box等其他正N面体,总而言之,可以避开这个函数不用。
【3】还有,赋值颜色一定要有VPython自定的color属性,直接写字符串报错。【这个是不是差异不知道,但之前看到过有人这么写】
------------------------
VPython有些地方的报错可能要在<审查>里看到(Edge浏览器),
主要操作使用鼠标滚轮以及左右键的拖动。
---------------------