pygame does not display pictures or errors under mac

When testing with pygame, the interface appears under the mac but the picture is not displayed
. Add the following code in the game loop to solve

# 监听事件
for event in pygame.event.get():
    # 判断事件类型是否是退出事件
    if event.type == pygame.QUIT:
        print("退出游戏...")
        # 卸载所有模块
        pygame.quit()
        # 直接终止当前正在执行的程序
        exit()

Another situation is that there is no update

# 在绘制工作完成之后 统一调用update更新 显示图片
pygame.display.update()
Published 41 original articles · Likes2 · Visits 1836

Guess you like

Origin blog.csdn.net/weixin_43883485/article/details/104554454