Python Pygame窗口赢得';我不会出现在Jupyter

Python Pygame窗口赢得';我不会出现在Jupyter,python,pygame,jupyter,Python,Pygame,Jupyter,我目前正试图在一个CoCalc项目的Jupyter笔记本中编写一个小型pygame游戏。作为第一个测试,我只是尝试用以下代码显示一个窗口: import pygame background_colour = (255,255,255) (width, height) = (300, 200) screen = pygame.display.set_mode((width, height)) pygame.display.set_caption('Tutorial 1') screen.fi

我目前正试图在一个CoCalc项目的Jupyter笔记本中编写一个小型pygame游戏。作为第一个测试,我只是尝试用以下代码显示一个窗口:

import pygame

background_colour = (255,255,255) 
(width, height) = (300, 200)

screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('Tutorial 1')
screen.fill(background_colour)

pygame.display.flip()

running = True
while running:
  
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False
      pygame.quit()

问题是,该窗口甚至没有显示在jupyter笔记本中。我从互联网上随意复制粘贴代码以确保没有任何错误,因此我怀疑问题来自Jupyter本身(例如视频驱动程序)是否有解决办法,或者说这根本不可能与Jupyter一起使用pygame?

似乎就像Jupyter笔记本电脑不支持GUI一样,所以我认为他们也不支持pygame


看看

就像Jupyter笔记本电脑不支持GUI一样,我认为他们也不支持pygame


看看

您是否收到任何错误或警告?是否收到任何错误或警告?