pyglet最近有变化吗?
Did pyglet change recently?
所以,前几天,我回到一个旧项目来完成它,但是当我尝试 运行 它时,它给了我几个错误,我试图修复但其中一些我没有不知道如何修复。当我停止工作时,该程序运行良好,所以我对发生的事情感到非常困惑。我的猜测是 pyglet 得到了新的更新并删除了很多我以前使用的东西。我得到的一些错误如下
Traceback (most recent call last):
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 9,
in <module>
screen =
pyglet.window.get_platform().get_default_display().get_default_screen()
AttributeError: module 'pyglet.window' has no attribute 'get_platform'
和
Traceback (most recent call last):
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 216, in <module>
main()
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 208, in main
win = Window(caption = "3D Program 1", width = WINW, height = WINH, resizable = False, vsync = True)
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 57, in __init__
self.tex1 = get_tex("steel_tex.png")
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 21, in get_tex
tex = pyglet.image.load(file).texture
AttributeError: 'ImageData' object has no attribute 'texture'
我也有问题说没有 "pyglet.graphics.TextureGroup" class
是的,看起来您显示的两个代码片段都使用了在以前的 Pyglet 版本中弃用并在最近的 1.4 版本中删除的功能。您可以在旧版本的文档中看到弃用(及其建议的替代品):
The get_platform()
function in pyglet.window
:
Deprecated. Use pyglet.canvas.Display
.
The .texture
attribute of an image:
Deprecated. Use get_texture()
.
所以,前几天,我回到一个旧项目来完成它,但是当我尝试 运行 它时,它给了我几个错误,我试图修复但其中一些我没有不知道如何修复。当我停止工作时,该程序运行良好,所以我对发生的事情感到非常困惑。我的猜测是 pyglet 得到了新的更新并删除了很多我以前使用的东西。我得到的一些错误如下
Traceback (most recent call last):
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 9,
in <module>
screen =
pyglet.window.get_platform().get_default_display().get_default_screen()
AttributeError: module 'pyglet.window' has no attribute 'get_platform'
和
Traceback (most recent call last):
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 216, in <module>
main()
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 208, in main
win = Window(caption = "3D Program 1", width = WINW, height = WINH, resizable = False, vsync = True)
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 57, in __init__
self.tex1 = get_tex("steel_tex.png")
File "C:\Users\____\Desktop\CodeD\ProjectsD Program 1\main.py", line 21, in get_tex
tex = pyglet.image.load(file).texture
AttributeError: 'ImageData' object has no attribute 'texture'
我也有问题说没有 "pyglet.graphics.TextureGroup" class
是的,看起来您显示的两个代码片段都使用了在以前的 Pyglet 版本中弃用并在最近的 1.4 版本中删除的功能。您可以在旧版本的文档中看到弃用(及其建议的替代品):
The get_platform()
function in pyglet.window
:
Deprecated. Use
pyglet.canvas.Display
.
The .texture
attribute of an image:
Deprecated. Use
get_texture()
.