Programming in vpython, vpython doesb't react at code

124 views Asked by At

I want to make a program that shows the da vinci tower in vpython and I think I got the right code to rotate the floors each in a sequence like in the da vinci tower. But vpython doesn't respond. What I'm I doing wrong? Can someone please help?

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)) 
1

There are 1 answers

0
Alex On

It's not that vpython is not responding, if you zoom into your cylinder, you'll see that the floors are contained inside it. You need to make your floors bigger and also your angle 0.01*floorNr is very small. I'd try 0.1*floorNr.

Also, in python you don't put semicolons at the end of lines.