简体   繁体   English

pyglet最近有变化吗?

[英]Did pyglet change recently?

So, The other day, I went back to an old project to finish it but when I tried running it, it gave me several errors that I've tried to fix but some of them I don't know how to fix.所以,前几天,我回到一个旧项目来完成它,但是当我尝试运行它时,它给了我几个我试图修复的错误,但其中一些我不知道如何修复。 The program worked fine when I stopped working on it, so I'm very confused at what happened.当我停止工作时,该程序运行良好,所以我对发生的事情感到非常困惑。 My guess is that pyglet got a new update and removed a lot of stuff I used to use.我的猜测是 pyglet 进行了新的更新并删除了我以前使用的很多东西。 Some of the errors I get are as follows我得到的一些错误如下

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'

and

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'

I also had problems with it saying that there was no such thing as the "pyglet.graphics.TextureGroup" class我也有问题说没有像“pyglet.graphics.TextureGroup”这样的东西

Yes, it looks like both of snippets of code you show are using features that were deprecated in previous versions of Pyglet and removed in the recent 1.4 release.是的,看起来您展示的两个代码片段都使用了在早期版本的 Pyglet 中已弃用并在最近的 1.4 版本中删除的功能。 You can see the deprecation (and their suggested replacements) in the documentation for older versions:您可以在旧版本的文档中看到弃用(及其建议的替代品):

The get_platform() function in pyglet.window : get_platform()函数pyglet.window

Deprecated.已弃用。 Use pyglet.canvas.Display .使用pyglet.canvas.Display

The .texture attribute of an image : 图像的.texture属性

Deprecated.已弃用。 Use get_texture() .使用get_texture()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM