Answer the question
In order to leave comments, you need to log in
Well, what's the matter?
Hello!
I'm learning pygame, and then a strange situation arose when I run the code, a black window comes out, I click on the cross of this window, and only then the real window comes out, what's the matter ??
here is the window:
here is the real window after clicking on the cross of the black window:
here is the code itself:
import pygame
p = pygame
window = p.display.set_mode((400, 400))
p.display.set_caption('Hellow World')
screen = p.Surface((400, 400))
square = p.Surface((40, 40))
square.fill((0, 255, 0))
done = True
while done:
for e in p.event.get():
if e.type == p.QUIT:
done = False
screen.fill((50, 50, 50))
screen.blit(square, (50, 100))
window.blit(screen, (0, 0))
p.display.flip()
Answer the question
In order to leave comments, you need to log in
Shouldn't these lines be at the end?
done = True
while done:
for e in p.event.get():
if e.type == p.QUIT:
done = False
I understand that the first window is something like a console, no?
Try to save the file in the .pyw extension.
If it is the same, then look for the problem in the thematic sections.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question