Opening the book…
DISPLAYSURF.fill(BGCOLOR)
drawGrid()
drawWorm(wormCoords)
drawApple(apple)
drawScore(len(wormCoords) - 3)
pygame.display.update()
FPSCLOCK.tick(FPS)
The code for drawing the screen in the runGame() function is fairly simple. Line 1 [101] fills in the entire display Surface with the background color. Lines 2 [102] to 5 [105] draw the grid, worm, apple, and score to the display Surface. Then the call to pygame.display.update() draws the display Surface to the actual computer screen.
This page titled 7.12: Drawing the Screen was last modified on Mon, 18 May 2020 08:26:07 GMT and is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Al Sweigart via source content that was edited to the style and standards of the LibreTexts platform.
The book could not be loaded just now.