IDLE and PyCharm Differences


Good day!
Sorry for my bad english.
I want to learn how to program. I'm trying to learn from videos on YouTube.
And when I run my code in PyCharm - it does not work, that is, a window just appears, and then disappears.
If you run from a standard development environment - everything works as it should.
Please tell me what could be the problem.
And once again, sorry for the stupid questions.

If that application code:

import pygame

win = pygame.display.set_mode((500, 500))

pygame.display.set_caption("Cubes game")

x = 50
y = 50
width = 40
heigth = 60
speed = 5

run = True
while run:

for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
x -= speed
if keys[pygame.K_RIGHT]:
x += speed
if keys[pygame.K_UP]:
y -= speed
if keys[pygame.K_DOWN]:
y += speed

pygame.draw.rect(win, (0,0,255), (x, y, width, heigth))

1 comment


Works just fine on my side. Please upload your idea.log (Help | Show Log in...) zipped to and let me know the name of that zip file.

Please also attach a screenshot with your Project Interpreter window (Settings/Preferences | Project | Project Interpreter).


Please sign in to leave a comment.