我正在尝试学习 Youtube 上的教程“用 Python [使用 Ursina Engine] 创建 Minecraft”。
一切都很顺利,直到我尝试向实体添加纹理。
我相信问题出在 Pandas 内部,但我不完全确定。
代码:
from ursina import *
def update():
if held_keys['a']:
test_square.x -= 4 * time.dt
app = Ursina()
test_square = Entity(model = 'quad', color = color.red, scale = (1,4), position = (5,4))
sans_texture = load_texture("C:\\Users\\north\\Desktop\\moose.png")
sans = Entity(model = 'quad', texture = sans_texture)
app.run()
终端错误:
ursina version: 3.5.0
package_folder: C:\Users\*****\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina
asset_folder: C:\Users\*****\Desktop\code
blender_paths:
{'2.7': WindowsPath('C:/Program Files/Blender Foundation/Blender/blender.exe'),
'default': WindowsPath('C:/Program Files/Blender Foundation/Blender/blender.exe')}
screen resolution: (1920, 1080)
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
size; LVector2f(1536, 864)
render mode: default
no settings.py file
no settings.py file
development mode: True
application successfully started
no filter quad
changed aspect ratio: 1.777 -> 1.778
我认为问题在于
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
和
successfully started no filter quad
部分。
我确实安装了pandas。为了完成本教程,我需要安装 Ursina。我像平常一样使用了 python -m pip install
方法。
我非常感谢有关此事的帮助。预先感谢您。
最佳答案
应用程序成功启动
表示没有错误并且启动成功。我相信问题出在您提供的 load_texture
路径上。
load_texture("C:\\Users\\north\\Desktop\\moose.png")
表示您正在搜索名为 C:\\Users\\的纹理North\\Desktop\\moose.png
在脚本所在的文件夹中。
它接受的参数是纹理的名称,以及它应该在其中搜索纹理的文件夹。因此,如果您坚持使用 load_texture
,您会执行以下操作:load_texture('moose.png ', Path('C:/Users/north/Desktop'))
但是,您甚至不应该使用load_texture
,而是将纹理放在同一文件夹中或脚本下方,并写下它的名称。如果您要共享您的游戏并让其他人玩它,您就不能指望人们的桌面上有 moose.png。代码将是:
sans = Entity(model='quad',texture='moose')
关于python - 在 Python 3.9 Ursina 代码中遇到问题。 "Known pipe types: wglGraphicsPipe (3 aux display modules not yet loaded.) when trying to use texture"秒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67612501/