import pygame from pygame.locals import * import sys BLACK = (0,0,0) RED = (255,0,0) GREEN = (0,255,0) BLUE = (0,0,255) WHITE = (255,255,255) pygame.init() # Initialize pygame modules screen = pygame.display.set_mode((800, 800)) screen.fill(WHITE) clock = pygame.time.Clock() smallfont = pygame.font.SysFont('Corbel', 80) text = smallfont.render('Button', True, RED) pygame.draw.rect(screen, BLACK, [250, 500, 300, 100]) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() mouse = pygame.mouse.get_pos() if event.type == pygame.MOUSEBUTTONDOWN: if 250 <= mouse[0] <= 550 and 500 <= mouse[1] <= 600: print("Button got pressed :3") else : print("Button not pressed D:") screen.blit(text, (295,515)) pygame.display.update() clock.tick(60)