gpt4 book ai didi

python - pyglet最近有变化吗?

转载 作者:太空宇宙 更新时间:2023-11-03 23:56:37 24 4
gpt4 key购买 nike

所以,前几天,我回到一个旧项目来完成它,但是当我尝试运行它时,它给了我几个我试图修复的错误,但其中一些我不知道如何修复.当我停止工作时,该程序运行良好,所以我对发生的事情感到非常困惑。我的猜测是 pyglet 得到了新的更新并删除了很多我以前使用的东西。我得到的一些错误如下

Traceback (most recent call last):
File "C:\Users\____\Desktop\Code\3D\Projects\3D 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\Code\3D\Projects\3D Program 1\main.py", line 216, in <module>
main()
File "C:\Users\____\Desktop\Code\3D\Projects\3D 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\Code\3D\Projects\3D Program 1\main.py", line 57, in __init__
self.tex1 = get_tex("steel_tex.png")
File "C:\Users\____\Desktop\Code\3D\Projects\3D 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”类这样的东西

最佳答案

是的,看起来您显示的两个代码片段都使用了在以前的 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().

关于python - pyglet最近有变化吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57453594/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com