怎么在python的IDLE中运行下面的程序让其显示出图形界面?
fromvisualimport*display(title=u"简单动画".encode("gb2312"),width=500,height=300,backgrou...
from visual import *
display(title=u"简单动画".encode("gb2312"), width=500, height=300, background=(1,1,1))
ball = sphere(pos=(0,0,0), radius=0.5, color=color.red)
wall_right = box(pos=(6,0,0), size=(0.1,4,4), color=color.green)
wall_left = box(pos=(-6,0,0), size=(0.1,4,4), color=color.green)
dt = 0.05
ball.velocity = vector(6,0,0)
while True:
rate(1/dt)
ball.pos = ball.pos +ball.velocity*dt
if ball.x >wall_right.x-ball.radius or ball.x<wall_left.x+ball.radius:
ball.velocity.x *= -1 展开
display(title=u"简单动画".encode("gb2312"), width=500, height=300, background=(1,1,1))
ball = sphere(pos=(0,0,0), radius=0.5, color=color.red)
wall_right = box(pos=(6,0,0), size=(0.1,4,4), color=color.green)
wall_left = box(pos=(-6,0,0), size=(0.1,4,4), color=color.green)
dt = 0.05
ball.velocity = vector(6,0,0)
while True:
rate(1/dt)
ball.pos = ball.pos +ball.velocity*dt
if ball.x >wall_right.x-ball.radius or ball.x<wall_left.x+ball.radius:
ball.velocity.x *= -1 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询