The main difference between pygame.display.flip and pygame.display.update is, that
display.flip() will update the contents of the entire display
display.update() allows to update a portion of the screen, instead of the entire area of the screen. Passing no arguments, updates the entire display
To tell PyGame which portions of the screen it should update (i.e. draw on your monitor) you can pass a single pygame.Rect object, or a sequence of them to the display.update() function. A Rect in PyGame stores a width and a height as well as a x- and y-coordinate for the position.
PyGame's built-in dawning functions and the .blit() method for instance return a Rect, so you can simply pass it to the display.update() function in order to update only the "new" drawn area.
Due to the fact that display.update() only updates certain portions of the whole screen in comparison to display.flip(), display.update() is faster in most cases.
I wonder why they didn't just make it update() with optional arguments. –
Sep 7 '20 at 16:16
Because flip might actually work faster due to the use of OpenGL/hardware acceleration. For example, for a simple loop with 3 sprites on a MacBook Pro 2019, pygame's flip gives "insane" 6 FPS compared to 3 FPS for an update of rect regions. –
Sep 27 '20 at 4:08