Code

Updating the Display in Pygame

There are multiple functions for updating displays--display.flip() and display.update(). Flip will update the whole display, whereas update will update only a portion of the screen (either a rectangle or a list of a rectangles). These functions are demonstrated below.

pygame.display.flip() #updates entire display surface pygame.display.update(rectangle) #updates a rectangular portion of display pygame.display.update(rectangle_list) #updates a list of rectangular portions

0

1

Updated 2021-06-16

Tags

Python Programming Language

Data Science