Jun-25-2021, 03:21 AM
I know nothing about pygame, just started learning about it. I got the code below from here.
I just put it in a function for trying it out in the Idle shell.
This draws a rectangle OK, but isn't the while loop always working??
Wouldn't it be enough to just draw the rectangle?
I just put it in a function for trying it out in the Idle shell.
This draws a rectangle OK, but isn't the while loop always working??
Wouldn't it be enough to just draw the rectangle?
def rect(): import pygame pygame.init() scr = pygame.display.set_mode((500,500)) color = (0,0,255) running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False pygame.draw.rect(scr, color, pygame.Rect(60, 60, 100, 100)) pygame.display.flip() pygame.quit()