import random
import pygame

# Define the artists and their monthly Spotify listeners
artists = {
    "Young Thug": {"Image": "C:/Users/elias/Documents/PycharmProjects/Python/Zelf/Python - Freegpt/Music/fotos (code)/fotos/Young_Thug/Young Thug_1.jpeg", "listeners": 28887553},
    "Yungeen Ace": {"Image": "C:/Users/elias/Documents/PycharmProjects/Python/Zelf/Python - Freegpt/Music/fotos (code)/fotos/Young_Thug/Young Thug_1.jpeg", "listeners": 1294188},
}

# Initialize Pygame
pygame.init()

# Set the screen dimensions
screen_width = 800
screen_height = 600
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Guess the Artist")

# Load the font
font = pygame.font.Font(None, 36)

def display_images(first_artist_image, second_artist_image):
    # Scale the images to fit the screen
    first_artist_image_scaled = pygame.transform.scale(first_artist_image, (screen_width // 2, screen_height))
    second_artist_image_scaled = pygame.transform.scale(second_artist_image, (screen_width // 2, screen_height))

    # Display the images on the screen
    screen.blit(first_artist_image_scaled, (0, 0))
    screen.blit(second_artist_image_scaled, (screen_width // 2, 0))

def display_text(text, x, y):
    # Render the text
    text_surface = font.render(text, True, (255, 255, 255))
    text_rect = text_surface.get_rect()
    text_rect.center = (x, y)

    # Display the text on the screen
    screen.blit(text_surface, text_rect)

def play_game():
    score = 0 # reset score at the beginning of each game
    first_artist, second_artist = random.sample(list(artists.keys()), 2)

    # Load the images for the artists
    first_artist_image = pygame.image.load(artists[first_artist]["Image"]).convert()
    second_artist_image = pygame.image.load(artists[second_artist]["Image"]).convert()

    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()

        # Display the images
        display_images(first_artist_image, second_artist_image)

        # Display the score
        display_text(f"Score: {score}", screen_width // 2, 50)

        # Display the artist names
        display_text(f"1. {first_artist.title()}", screen_width // 4, screen_height - 50)
        display_text(f"2. {second_artist.title()}", screen_width // 4 * 3, screen_height - 50)

        pygame.display.flip()

        guess = None
        while guess is None:
            for event in pygame.event.get():
                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_1:
                        guess = first_artist
                    elif event.key == pygame.K_2:
                        guess = second_artist
                    elif event.key == pygame.K_q:
                        pygame.quit()
                        quit()

        if artists[guess]["listeners"] > artists[first_artist if guess == second_artist else second_artist]["listeners"]:
            score += 1
            first_artist, second_artist = random.sample(list(artists.keys()), 2)

            # Load the images for the new artists
            first_artist_image = pygame.image.load(artists[first_artist]["Image"]).convert()
            second_artist_image = pygame.image.load(artists[second_artist]["Image"]).convert()

# Start the game
play_game()
why doesnt anything happen when i ^ress 1 or 2