from visual import * floor = box (pos=(0,0,0), length=4, height=0.5, width=4, color=color.blue) ball = sphere (pos=(0,4,0), radius=1, color=color.red) ball.velocity = vector(0,-1,0) dt = 0.01 while 1: rate (100) ball.pos = ball.pos + ball.velocity*dt if ball.y < ball.radius: ball.velocity.y = -ball.velocity.y else: ball.velocity.y = ball.velocity.y - 9.8*dt |
The first line
Here's a registration-file for Windows 2000 and Windows XP that will fix that problem with the IDLE editor closing completely when terminating an animation you are working on. Python24-File-new.reg for the SU installation of VPython. It assumes that you installed Python in the C:\ drive. If so, you may just "Open" it. Otherwise, you must "Save" it, then edit it if you installed it elsewhere. Then, "Merge" it by double-clicking on it. |
Here are my registry hacks to address the problem described above.