Dec-03-2021, 07:06 AM
(Dec-01-2021, 05:45 PM)BashBedlam Wrote: Okay... In this version, when the dot reaches the middle, we usebreak
to fall through the firstwhile
loop. After that we print to the screen and wait for the user to close the window. That is where you would put any extra code. Does that help?
from pygame import display, QUIT, event, draw, time, font, init SCREEN = display.set_mode ((500, 500)) init () dot_x_position = 30 while True : for user_input_event in event.get () : if user_input_event.type == QUIT : exit () SCREEN.fill ((0, 0, 0)) draw.circle (SCREEN, (200, 0, 0), (249, 249), 220, 4) draw.circle (SCREEN, (0, 0, 200), (dot_x_position, 249), 20) if dot_x_position < 249 : dot_x_position += 1 else : break time.Clock ().tick (100) display.update () text = font.SysFont ('ariel', 42).render ('Close window to contunue.', 1, (255, 255, 255), (1, 1, 1)) SCREEN.blit (text, (70, 50)) display.update () while True : for user_input_event in event.get () : if user_input_event.type == QUIT : exit ()
Many thanks! Now I got it running. Your help is very much appreciated!