I am currently developing a game using Python and PyGame. I made a egg sprite for click on it to gain money, but I don't know how to make images clickable, so you can earn money by clicking anywhere. Source code:
import pygame, sys, time
from pygame.locals import *
from millify import millify,prettify
pygame.init()
WHITE = 255,255,255
font = pygame.font.SysFont(None, 44)
cpsecond = open("clickpersecond.txt", "r+")
cps = int(cpsecond.read())
baltotal = open("totalbal.txt", "r+")
totalbal = int(baltotal.read())
totalbalM = prettify(totalbal, '.')
ev = pygame.event.get()
clock = pygame.time.Clock()
w = 800
h = 600
screen = pygame.display.set_mode((w,h))
pygame.display.set_caption('Tap Simulator')
Loop = True
background = pygame.image.load("C:\\Users\\Lenovo\\Desktop\\Tap Simulator\\Background.jpg")
egg = pygame.image.load("C:\\Users\\Lenovo\\Desktop\\Tap Simulator\\egg.png")
resized_egg = pygame.transform.scale(egg, (282, 352))
text = font.render(f'Your total clicks are {totalbalM}', True, WHITE)
while Loop: # main game loop
    for event in pygame.event.get():
        if event.type == QUIT:
            Loop = False
        if event.type == MOUSEBUTTONDOWN: #detecting mouse click
                totalbal += cps
                totalbalM = prettify(totalbal, '.')
                text = font.render(f'Your total clicks are {totalbalM}', True, WHITE)
                print("Your total clicks are", totalbalM, end="\r")
    #print(pygame.mouse.get_pos()) #to get mouse pos
    screen.blit(background, (0,0))
    screen.blit(text, (235,557))
    screen.blit(resized_egg, (260,150))
    pygame.display.flip()
    pygame.display.update()
    clock.tick(30)
with open("totalbal.txt", "w") as baltotal:
    baltotal.write(str(totalbal))
baltotal.close
pygame.quit()
sys.exit()
 
    