pygame窗口无法通过python启动器在Mac中打开

时间:2020-04-18 11:31:26

标签: python python-3.x pygame pygame-surface python-turtle

当pygame模块单独运行时,该窗口不会出现

import pygame

pygame.init()

screen = pygame.display.set_mode((800, 600))

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

When pygame module is running alone,window is does not appear

将pygame模块与turtle模块一起使用时,两者都会出现

import pygame
import turtle

#initialize the pygame
pygame.init()

#creating a window
wn=turtle.Screen()
wn.setup(width=600,height=800)
wn.bgcolor("black")
screen = pygame.display.set_mode((800, 600))

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

When pygame module is running along with turtle module,both the windows appear

我知道这是一个奇怪的问题,我已经看到几个macOS用户面临相同的问题,我不知道这是否是因为操作系统。我使用Visual Studio代码。任何帮助将不胜感激。谢谢

0 个答案:

没有答案