recipe-502253.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:code 作者: ActiveState 项目源码 文件源码
def update():
    try:
        ident = screen.after(1000 / FPS, update)
        for mutate in container, governor:
            for ball in balls:
                mutate(ball)
        for index, ball_1 in enumerate(balls[:-1]):
            for ball_2 in balls[index+1:]:
                ball_1.crash(ball_2)
        for ball in balls:
            ball.move(FPS)
        screen.delete(ALL)
        for ball in balls:
            x1 = ball.pos.x - BALL_RADIUS
            y1 = ball.pos.y - BALL_RADIUS
            x2 = ball.pos.x + BALL_RADIUS
            y2 = ball.pos.y + BALL_RADIUS
            screen.create_oval(x1, y1, x2, y2, fill=BALL_COLOR)
    except:
        screen.after_cancel(ident)
        screen.delete(ALL)
        screen.create_text(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, text=format_exc(), font='Courier 10', fill='red')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号