【问题标题】:Searching tmx lib can export/save map搜索 tmx lib 可以导出/保存地图
【发布时间】:2015-08-05 07:59:29
【问题描述】:

我搜索了一个可以使用 python3 以 tmx 格式导出/保存map 的库。我发现:

PyTMX 但是,doc says

最后,没有保存功能。加载地图后,将由您提供一种方法来保存对地图的更改。我使用了 pickle 模块,效果很好。

tmxlibdoc 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 的方法吗?

【问题讨论】:

  • IndexError: list index out of range 听起来像是库本身的问题。我建议在库的错误跟踪器中提交问题。
  • 好主意。但我没有找到这个项目的电子邮件或跟踪器。你呢?

标签: python python-3.x tmx


【解决方案1】:

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

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

    python setup.py 安装

希望它会起作用。另外我认为这个库很好。可能是你的 pip 版本中存在错误。

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2013-05-16
      • 1970-01-01
      • 1970-01-01
      • 2019-07-06
      • 2012-09-17
      • 2013-05-14
      • 2013-06-03
      • 1970-01-01
      • 2020-09-23
      相关资源
      最近更新 更多