My python file runs perfectly in cmd, but doesnt run in IDLE

I made a rock-paper-scissors game using the pygame module in python. It runs perfectly well in the IDE(PyCharm) and the command prompt and everything works (including the cross button), but when I press the cross-button of the GUI window when the code is running in IDLE, the game crashes.

I don’t get any error messages, but the game freezes after I press the cross button once; then I cant give any more inputs to the window, but the cross button glows red when you hover over it, but if u press it again (2nd time), then the cross button stops glowing red when you hover over it and the game remains frozen.

This portion of the code isn’t working in IDLE:-

#Game-loop
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False #this doesnt seem to work in python IDLE but works perfectly in cmd and PyCharm

If you want to see the full code, here’s the GitHub repository.

Hello!

Is pygame installed on your system? I assume, that is not the case! Check that in idle3… as follows:

import pygame

If it is installed this information appears:

pygame 2.0.0.dev6 (SDL 2.0.10, python 3.8.0)

Otherwise you have to install it. The installtion instruction depends on the operating system you are using.
Hopefully your code will also work in idle3 after the installation.