为什么会出现错误“无法加载外部图块集”

时间:2019-06-06 13:06:21

标签: python pygame tiled pytmx

我只想知道如何解决标题中提到的错误。

我真的不知道该怎么尝试,只有三行代码,它们正是pytmx文档中的显示方式……

import pygame
import pytmx

tmxdata = pytmx.TiledMap("map test pygame.tmx")

我只想“加载”我创建的地图,而不会出现巨大错误:

Cannot load external tileset: C:\Users\WILHEM\Desktop\brdl Python 3\projet\labyrinthe\test pygame tileset.tsx
Traceback (most recent call last):
  File "C:\Users\WILHEM\Desktop\brdl Python 3\projet\labyrinthe\testTMX.py", line 4, in <module>
    tmxdata = pytmx.TiledMap("C:/Users/WILHEM/Desktop/brdl Python 3/projet/labyrinthe/carte test pygame.tmx")
  File "C:\Users\WILHEM\Desktop\brdl Python 3\Python37-32\lib\site-packages\pytmx\pytmx.py", line 360, in __init__
    self.parse_xml(ElementTree.parse(self.filename).getroot())
  File "C:\Users\WILHEM\Desktop\brdl Python 3\Python37-32\lib\site-packages\pytmx\pytmx.py", line 400, in parse_xml
    self.add_tileset(TiledTileset(self, subnode))
  File "C:\Users\WILHEM\Desktop\brdl Python 3\Python37-32\lib\site-packages\pytmx\pytmx.py", line 845, in __init__
    self.parse_xml(node)
  File "C:\Users\WILHEM\Desktop\brdl Python 3\Python37-32\lib\site-packages\pytmx\pytmx.py", line 874, in parse_xml
    raise Exception
Exception

如果您能帮助我...衷心感谢您!

1 个答案:

答案 0 :(得分:0)

from pytmx.util_pygame import load_pygame

load_pygame(filename,pixilalpha=True)