示例#1
0
# Runtime:
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            quit()

    # Fill the window:
    window.fill(window_color)

    # Divide the bar in pieces:
    piece_of_the_bar = ((width / ((minutes_in_total * 60)) /
                         bar.smoothness_of_bar))

    # Add that piece to the bar:
    bar.draw(add_value=piece_of_the_bar)

    # Define and draw the actual time to the screen:
    text.define_what_to_write(time.gmtime(seconds_in_total)[3:6])
    text.draw()

    # Down the seconds if one second has passed:
    # case the smoothnes of bar == 1, add every loop
    # and wait 1 second:
    if c % bar.smoothness_of_bar == 0 and seconds_in_total > 0:
        seconds_in_total -= 1

    # If the smoothnes of bar == 1, the program waits 1 second,
    # and the bar go second per second:
    time.sleep(1 / bar.smoothness_of_bar)