Function: play_music(file)
TRY Load the music file using pygame
Play the music in a continuous loop
CATCH exception
Ignore if the file cannot be loaded
Function: load_logos()
TRY Open 'logo_guessing.json' and load logo data into
'all_logos'
CATCH exception
Show an error message
Exit
Function: show_category_screen()
Clear the screen Display the title: "Select Category"
For each category (Food, Clothing, Cars, Tech)
Create and display a button
On click, start game with selected category
Function: start_game(category)
Reset score and logo index
Filter logos by selected category and store in 'filtered_logos'
Shuffle the list
Start with the first logo using 'next_logo()'
Function: next_logo()
IF there are more logos to display
Load next logo into 'current_logo'
Increment logo index
Reset attempts Show the logo screen
ELSE Show final score
Function: show_logo_screen()
Clear the screen
Display the current logo image
Create an entry box for user answer input Bind Return key to
'check_answer()' Create a feedback label for correct/wrong
messages
Create three buttons:
- Submit: calls 'check_answer()'
- Hint: calls 'show_hint()'
- Skip: calls 'next_logo()'
Function: check_answer()
Get user's answer and convert to lowercase
Compare with correct answer (also lowercase)
Increment attempts
IF answer is correct
Increment score
Show "Correct!" feedback
Move to next logo after a short delay
ELSE IF attempts remain
Show "Wrong!" feedback with attempt count
Clear the entry field
ELSE Show correct answer
Move to next logo after a short delay
Function: show_hint()
IF hints are available for the current logo Display a random
hint
ELSE Display "No hint available"
Function: show_score()
Clear the screen
Display the user's score
Create a "Play Again" button that returns to category screen
Function: clear_screen()
Destroy all widgets from the root window