def build_graph():
# Build GUI environment.
global frame_handle, y, x, start, sec, timer_text, clock_handle
frame_handle = graph.after(1000 / FRAMES_PER_SEC, update)
graph.bind('<1>', change)
graph['background'] = GAME_COLOR
# Draw environment.
y = HEIGHT - WALL + BALL_RADIUS + 2
graph.create_rectangle((0, 0, WALL - BALL_RADIUS, y), fill=FORCE_COLOR)
graph.create_rectangle((WIDTH - WALL + BALL_RADIUS, 0, WIDTH, y), fill=FORCE_COLOR)
graph.create_line((0, y, WIDTH, y), fill=FLOOR_COLOR, width=3)
# Prepare timer data.
x = (WALL - BALL_RADIUS) / 2
y = (y + HEIGHT) / 2
start = time.clock()
sec = 0
timer_text = graph.create_text(x, y, text=f_time(TIME_LIMIT))
clock_handle = graph.after(1000, update_clock)
################################################################################
# ANIMATION LOOP FUNCTIONS
评论列表
文章目录