为什么Pyglet无法从Python IDLE中正确运行?

时间:2017-09-28 15:09:22

标签: python python-idle pyglet

在我的Windows 10计算机上安装Pyglet库之后,我决定通过运行 Writing a pyglet application 提供的缩短版代码来测试它是否正常工作:

import pyglet
window = pyglet.window.Window(width=640, height=320, caption='window')
pyglet.app.run()

但是,当窗口最终显示时,显示的是:

enter image description here

为了确保这不是操作系统问题,我回过头来重新阅读pyglet要求。 It stated that it would work with Windows XP and greater

  
      
  • Windows XP或更高版本

  •   
  • Mac OS X 10.3或更高版本

  •   
  • Linux,包含以下库(最新的发行版将是   将它们放在默认安装中):

    OpenGL and GLX
    GDK 2.0+ or PIL (required for loading images other than PNG and BMP)
    Pulseaudio or OpenAL (required for playing audio)
    
  •   

问题似乎是特定于平台的,因为Pyglet在Linux上工作(Ubuntu 16.04)。最后,在考虑了一下之后,我决定尝试从命令行运行代码,因为我当前正在从Python IDLE运行它。果然,代码运行并且窗口显示正确:

enter image description here

然后我意识到这是我在Linux上运行代码时唯一的区别;我使用过命令行。虽然我无法绝对肯定地证实这一点,但这似乎只是通过在Python的IDLE中运行代码而产生的问题。

是否有其他人遇到此行为。这是一个已知的问题吗?如果是这样,导致它的原因是什么?

0 个答案:

没有答案