VPython 7 - 没有找到模块可视化
VPython 7 - No module visual is found
我正在研究书中的一些 Python 示例。列出的许多代码都需要一个模块 visual
。我相信 visual 已安装在旧版本的 Vpython 中。我是 运行 Python 3.6,安装了 Vpython 7。我使用 Mac 电脑。许多示例代码以如下行开头:
from visual import *
from visual.graph import *
from visual.graph import gdisplay, gcurve
from visual.controls import slider, controls, toggle
我通过互联网搜索得知将第一行替换为:
from vpython import *
这不适用于其他视觉调用。我的程序不断崩溃,因为找不到模块可视化。有没有办法让这些调用起作用?
存在从经典 VPython 转换到新 VPython 7 的转换程序。请在此处查看详细信息。
http://www.glowscript.org/docs/VPythonDocs/index.html
哪里说...
"Many programs written in Classic VPython 6 will run in GlowScript VPython or VPython 7 without change after being run through a conversion program written in Python. This program converts (x,y,z) => vector(x,y,z) and obj.x => obj.pos.x. These changes are necessary because GlowScript does not recognize (x,y,z) as a vector nor obj.x as a shorthand for obj.pos.x. The program also converts display => canvas and gdisplay => graph. The program also converts scene.mouse.getclick() => scene.waitfor('click'), which works in both environments."
python 转换程序是。
我正在研究书中的一些 Python 示例。列出的许多代码都需要一个模块 visual
。我相信 visual 已安装在旧版本的 Vpython 中。我是 运行 Python 3.6,安装了 Vpython 7。我使用 Mac 电脑。许多示例代码以如下行开头:
from visual import *
from visual.graph import *
from visual.graph import gdisplay, gcurve
from visual.controls import slider, controls, toggle
我通过互联网搜索得知将第一行替换为:
from vpython import *
这不适用于其他视觉调用。我的程序不断崩溃,因为找不到模块可视化。有没有办法让这些调用起作用?
存在从经典 VPython 转换到新 VPython 7 的转换程序。请在此处查看详细信息。
http://www.glowscript.org/docs/VPythonDocs/index.html
哪里说...
"Many programs written in Classic VPython 6 will run in GlowScript VPython or VPython 7 without change after being run through a conversion program written in Python. This program converts (x,y,z) => vector(x,y,z) and obj.x => obj.pos.x. These changes are necessary because GlowScript does not recognize (x,y,z) as a vector nor obj.x as a shorthand for obj.pos.x. The program also converts display => canvas and gdisplay => graph. The program also converts scene.mouse.getclick() => scene.waitfor('click'), which works in both environments."
python 转换程序是。