Original Post
Hi, so I started programming python recently, including pygame library. And now I have this bit of code:
and for some unpredicted reason, screen freezes as I try to run this code.
Maybe you know what is the problem?
Thanks
import pygamepygame.init()screen = pygame.display.set_mode((640, 480))pygame.display.set_caption("move a box")background = pygame.Surface(screen.get_size())background = background.convert()background.fill((255, 255, 0))box = pygame.Surface((25, 25))box = box.convert()box.fill((255, 0, 0))box_x = 0box_y = 200clock = pygame.time.Clock()keepGoing = Truewhile keepGoing: clock.tick(30) for event in pygame.event.get(): if event.type == pygame.QUIT: keepGoing = False box_x += 5 if box_x > screen.get_width(480): box_x = 0 screen.blit(background, (0, 0)) screen.blit(box, (box_x, box_y)) pygame.display.flip()and for some unpredicted reason, screen freezes as I try to run this code.
Maybe you know what is the problem?
Thanks