【发布时间】:2021-07-04 15:55:43
【问题描述】:
我有一个代码,我想使用 vpython 查看输出。 以下是代码
#!/usr/local/bin/ python3
from vpython import *
Plot1 = gcurve ( color = color . white )
for x in arange(0., 8.1, 0.1):
Plot1.plot( pos = (x, 5.*cos(2.*x)*exp(-0.4*x)) )
graph1 = gdisplay ( width =600, height =450 ,\
title="Visual 2D Plot", xtitle="x", ytitle="f(x)",\
foreground = color . black , background = color . white )
Plot2 = gdots ( color = color . black )
for x in arange( -5., +5, 0.1 ):
Plot2.plot(pos = (x, cos(x)))
它给出了这个错误,但是,它显示了一个白色背景的框,其中没有任何情节。 错误:未定义名称“gdisplay”
如何定义g显示?
【问题讨论】: