I wrote a pygame code like this.
pygame.init()
win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("Test")
black = (0, 0, 0)
sysfont = pygame.font.SysFont(None, 50)
win.fill((255, 255, 255))
running = True
while running:
win.fill((255, 255, 255))
digit = sysfont.render("Test", 1, black)
win.blit(digit, (50, 50))
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.quit()
So That's just to create a window and show some text on it. I runned it on Jupyter Notebook and it worked. but when I closed the window and tried to run it again, a window came up but closed of itself and Jupyter said "The kernel appears to have died." This happened again and again. I runned it, it worked. but I rerunned it, it failed. Is there anything wrong with this code?