Skip to main content
Engineering LibreTexts

7.36: Drawing the “Next” Piece

  • Page ID
    14615
  • def drawNextPiece(piece):
        # draw the "next" text
        nextSurf = BASICFONT.render('Next:', True, TEXTCOLOR)
        nextRect = nextSurf.get_rect()
        nextRect.topleft = (WINDOWWIDTH - 120, 80)
        DISPLAYSURF.blit(nextSurf, nextRect)
        # draw the "next" piece
        drawPiece(piece, pixelx=WINDOWWIDTH-120, pixely=100)
    
    
    if __name__ == '__main__':
        main()
    

    The drawNextPiece() draws the "Next" piece in the upper right corner of the screen. It does this by calling the drawPiece() function and passing in arguments for drawPiece()’s pixelx and pixely parameters.

    That’s the last function. Line 11 [505] and 12 [506] are run after all the function definitions have been executed, and then the main() function is called to begin the main part of the program.