Skip to content

Feature Request: Support for Writing TSX (Tileset) Files in PyTMX #203

@BusyByte

Description

@BusyByte

Feature Request: Support for Writing TSX (Tileset) Files in PyTMX

Description

I would like to request support in PyTMX for creating and writing TSX (Tileset) files programmatically. Currently, PyTMX provides robust support for reading TMX and TSX files, but there is no public API for generating or serializing TSX files from Python code.

Motivation

  • Many workflows require generating tilesets dynamically or exporting tileset metadata from Python tools.
  • Having a public API for TSX writing would enable procedural content pipelines, asset conversion tools, and automated tileset management.
  • This would bring PyTMX closer to feature parity with the Tiled editor and make it more useful for game development and toolchain automation.

Requested Features

  • Public API for creating a new TSX (Tileset) object from scratch in Python.
  • Methods for setting tileset properties (name, tile size, image source, tile count, etc.).
  • Methods for adding and configuring individual tiles, including custom properties and terrain data.
  • A method to serialize and write the TSX object to disk as a valid TSX XML file.

Current Workarounds

  • Manually writing TSX XML using custom code, which is error-prone and duplicates logic already present in PyTMX.
  • Using the Tiled editor for all tileset creation, which is not suitable for automated or programmatic workflows.

Thank you for your work on PyTMX!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions