You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to use a .tmx with all layers stored in layer groups, I get this error
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytmx/pytmx.py", line 682, in get_layer_by_name
return self.layernames[name]
KeyError: 'background'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "convoke/world.py", line 81, in <module>
Scene(landscape_path).run()
File "convoke/world.py", line 34, in __init__
bg_layer = scene_data.get_layer_by_name('background')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytmx/pytmx.py", line 686, in get_layer_by_name
raise ValueError
ValueError
I tried printing the value in .layernames and .layers, both were empty. I changed the map to not use layer groups at all, and PyTMX recognized all of the layers. Seems like it is failing to recognize layer groups.
The text was updated successfully, but these errors were encountered:
Ah, there are some misleading points in the README, then. Here is an example:
# get a layer by name
layer_or_group = tiled_map.get_layer_by_name("base layer")
# TiledMap.layers is a list of layers and groups
layer = tiled_map.layers[layer_index_number]
This sounds like I can access layer groups the same way I access layers.
When I try to use a .tmx with all layers stored in layer groups, I get this error
I tried printing the value in
.layernames
and.layers
, both were empty. I changed the map to not use layer groups at all, and PyTMX recognized all of the layers. Seems like it is failing to recognize layer groups.The text was updated successfully, but these errors were encountered: