使pygame在Macos Mojave上显示空白屏幕时出现问题 [英] Problems getting pygame to show anything but a blank screen on Macos Mojave

查看:100
本文介绍了使pygame在Macos Mojave上显示空白屏幕时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近购买了一台新的Macbook,并且我一直在不懈地尝试使pygame正常工作,但是还没有成功.我变得非常绝望,我真的可以使用一些帮助.

I recently bought a new macbook and I've been trying endlessly to get pygame to work, but haven't succeeded yet. I'm getting pretty desperate and I could really use some help.

我已经安装了pygame 1.9.4,即使在运行pygame代码时没有收到任何错误消息,它也只显示空白屏幕.我正在使用以下代码对其进行测试:

I've installed pygame 1.9.4 and even though I don't get any error messages when running pygame code, it won't show me anything but a blank screen. I'm using the following code to test it:

import pygame
pygame.init()

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

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

    screen.fill((255,0,0))
    pygame.display.update()

pygame.quit()

在我的旧Macbook上,测试代码为我提供了一个如预期的红屏.两台Macbook都在运行python 2.7.10.

On my old macbook the test code gives me a red screen as expected. Both macbooks are running python 2.7.10.

有人知道我在做什么错吗?我想我完全像在旧Macbook上一样安装了pygame,唯一的区别似乎是操作系统.

Does anyone have any idea what I'm doing wrong? I think I installed pygame exactly like I did on my old macbook and the only difference seems to be the operating system.

我用Sublime Text编写脚本,然后在Terminal中运行程序. 屏幕截图

edit 1: I write the script in Sublime Text and run the program in Terminal. Screenshot

通过将操作系统降级到macOS High Sierra,再次使pygame正常工作.

edit 2: I got pygame working again by downgrading my operating system to macOS High Sierra.

推荐答案

我尝试将旧的Macbook升级到Mojave操作系统,以查看pygame是否将停止运行,并且做到了!

I tried upgrading my old macbook to OS Mojave to see if pygame would stop working, and it did!

我猜Mojave与pygame不兼容.

I guess Mojave isn't compatible with pygame (yet).

感谢您的帮助!

这篇关于使pygame在Macos Mojave上显示空白屏幕时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆