搜索 tmx 库可以 export/save 映射

Searching tmx lib can export/save map

我搜索了一个可以 export/save map tmx 格式 python3 的库。我发现:

PyTMX but, doc says:

Finally, there is no save feature. Once the map is loaded, it will be up to you to provide a way to save changes to the map. I've used the pickle module with good results.

tmxlib where doc says:

Saving is equally easy:

>>> map.save('saved.tmx')
>>> map_as_string = map.dump()

但是pip安装失败(python3):

pip install tmxlib
Downloading/unpacking tmxlib
  Downloading tmxlib-0.2.1.tar.gz
  Running setup.py (path:/home/bux/.virtualenvs/testsynergine2/build/tmxlib/setup.py) egg_info for package tmxlib

    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/setup.py", line 59, in <module>
        import tmxlib
      File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/tmxlib/__init__.py", line 9, in <module>
        from tmxlib.map import Map
      File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/tmxlib/map.py", line 5, in <module>
        from tmxlib import helpers, fileio, tileset, layer
      File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/tmxlib/tileset.py", line 8, in <module>
        from tmxlib import helpers, fileio, tile, image, terrain
      File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/tmxlib/image.py", line 28, in <module>
        preferred_image_class = image_classes[0]
    IndexError: list index out of range
    Complete output from command python setup.py egg_info:
    running egg_info

creating pip-egg-info/tmxlib.egg-info

writing top-level names to pip-egg-info/tmxlib.egg-info/top_level.txt

writing requirements to pip-egg-info/tmxlib.egg-info/requires.txt

writing dependency_links to pip-egg-info/tmxlib.egg-info/dependency_links.txt

writing pip-egg-info/tmxlib.egg-info/PKG-INFO

writing manifest file 'pip-egg-info/tmxlib.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found



reading manifest file 'pip-egg-info/tmxlib.egg-info/SOURCES.txt'

writing manifest file 'pip-egg-info/tmxlib.egg-info/SOURCES.txt'

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/setup.py", line 59, in <module>

    import tmxlib

  File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/tmxlib/__init__.py", line 9, in <module>

    from tmxlib.map import Map

  File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/tmxlib/map.py", line 5, in <module>

    from tmxlib import helpers, fileio, tileset, layer

  File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/tmxlib/tileset.py", line 8, in <module>

    from tmxlib import helpers, fileio, tile, image, terrain

  File "/home/bux/.virtualenvs/testsynergine2/build/tmxlib/tmxlib/image.py", line 28, in <module>

    preferred_image_class = image_classes[0]

IndexError: list index out of range

----------------------------------------
Cleaning up...

您知道 tmx 库可以做到这一点,或者知道安装 tmxlib 的方法吗?

我现在已经使用 pip 成功地 python3 安装了相同的库。如果 pip install 不适合您,那么:

  1. https://pypi.python.org/pypi/tmxlib/0.2.1
  2. 下载压缩包
  3. 解压上面的包。
  4. 解压后的目录中有一个脚本"setup.py"
  5. 运行 这个脚本通过终端给出命令

    python setup.py 安装

希望它会起作用。我也认为这个库很好..可能你的 pip 版本中有一个错误。

可用的其他 tmx 库:http://pythonhosted.org/tmx/ (https://pypi.python.org/pypi/tmx。这可以加载和保存。