Now that we've got these nice interactive buttons, we probably should put some text on them that lets the user know what the button actually does.
Just like our interactive button was really mostly just an addition of a bit of collision logic from before, placing our text will be very similar to the logic we used to place text to the screen.
def game_intro(): intro = True while intro: for event in pygame.event.get(): #print(event) if event.type == pygame.QUIT: pygame.quit() quit() gameDisplay.fill(white) largeText = pygame.font.Font('freesansbold.ttf',115) TextSurf, TextRect = text_objects("A bit Racey", largeText) TextRect.center = ((display_width/2),(display_height/2)) gameDisplay.blit(TextSurf, TextRect) mouse = pygame.mouse.get_pos() #print(mouse) if 150+100 > mouse[0] > 150 and 450+50 > mouse[1] > 450: pygame.draw.rect(gameDisplay, bright_green,(150,450,100,50)) else: pygame.draw.rect(gameDisplay, green,(150,450,100,50)) smallText = pygame.font.Font("freesansbold.ttf",20) textSurf, textRect = text_objects("GO!", smallText) textRect.center = ( (150+(100/2)), (450+(50/2)) ) gameDisplay.blit(textSurf, textRect) pygame.draw.rect(gameDisplay, red,(550,450,100,50)) pygame.display.update() clock.tick(15)