Skip to main content
Engineering LibreTexts

7.13: Drawing “Press a key” Text to the Screen

  • Page ID
  • def drawPressKeyMsg():
        pressKeySurf = BASICFONT.render('Press a key to play.', True, DARKGRAY)
        pressKeyRect = pressKeySurf.get_rect()
        pressKeyRect.topleft = (WINDOWWIDTH - 200, WINDOWHEIGHT - 30)
        DISPLAYSURF.blit(pressKeySurf, pressKeyRect)

    While the start screen animation is playing or the game over screen is being shown, there will be some small text in the bottom right corner that says "Press a key to play." Rather than have the code typed out in both the showStartScreen() and the showGameOverScreen(), we put it in a this separate function and simply call the function from showStartScreen() and showGameOverScreen().

    • Was this article helpful?