Help with pygame window in text game

Hello I am quite a noob with python and replit.

I was just experimenting and made a little text adventure game. In the middle of the game I added a pygame window that does some basic stuff. Afterwards the pygame window is suppose to close and go back to the console.

This works perfectly fine in visual studios and when I’m in editor mode in replit. But when I run game in my published project the output window for pygame doesn’t close and go back to terminal. It just leaves a fullscreen blank output window. Any ideas on how to fix this? Is there a better way to share my dumb fat lil noobie text game with a few friends outside of replit?

elif event.type == pygame.KEYDOWN:
  if event.key == pygame.K_RETURN:
     pygame.quit()
    occurences.combodone()

Also this is currently how I’m closing the pygame. Works fine outside of replit, where the output window stays fullscreened.

Hey, @VCarver1 welcome to the forums!

Can you please provide a link to the repl? This way it is easier for staff and members of the community to help you!

Also see this guide on how to share your code:

I made an example project to show the problem.

https://replit.com/@VCarver1/ExamplePygame

It starts as a text game in the console. Opens a pygame window in replits output window. In ShootingGame/main.py line 158 I quit pygame and call a function to resume the text adventure. The problem is replit doesn’t close the output window that pygame is placed inside of it, so it doesn’t return to the console. Works perfectly fine while ran in visual studios / locally.

Just don’t know how to close replits output window and go back to console.