【问题标题】:Programming in vpython, vpython doesb't react at code在 vpython 中编程,vpython 对代码没有反应
【发布时间】:2013-12-27 21:19:15
【问题描述】:

我想制作一个在 vpython 中显示达芬奇塔的程序,我认为我得到了正确的代码,可以像在达芬奇塔中一样按顺序旋转每个楼层。但是 vpython 没有响应。我做错了什么?有人可以帮忙吗?

from visual import *
from math import *
scene.autocenter=True

print "Give the desired square meters per floor:"
SquareMeters= int(raw_input());
side=sqrt(SquareMeters)
print "Give the desired height of the tower in meters"
demandedHeight= int(raw_input());
totalFloors = demandedHeight/3;
carryingStructure= cylinder(pos=(0,-1,0), axis=(0,demandedHeight,0), radius=10)
height=0;
floors=[]

v=frame()
while height < demandedHeight:
    f = box(frame=v,pos=(0,height,0),size=(side,3,side))
    floors.append(f)
    height += 3.5
    f
print totalFloors;

for floorNr in range(len(floors)):
    floor = floors[floorNr]
    floor.rotate(angle=0.01*floorNr, axis=(0,1,0), origin=(0,0,0)) 

【问题讨论】:

    标签: windows python-2.7 vpython rotateanimation


    【解决方案1】:

    不是 vpython 没有响应,如果你放大你的圆柱体,你会看到地板包含在它里面。你需要让你的地板更大,而且你的角度0.01*floorNr非常小。我会试试0.1*floorNr

    另外,在 python 中,您不会在行尾放置分号。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-27
      • 1970-01-01
      • 2018-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多