The official documentation describes that layers can be used to set the occlusion of rendered elements
canvas.layer(name, above=None, below=None)
This method creates or gets a layer with name name.
A layer is a canvas itself and can be used to combine drawing operations for ordering purposes, i.e., what is above and below each other. The layer name name is a dotted string, where dots are used to form a hierarchy of layer groups. When inserting a layer, it is put on top of its layer group except when another layer instance of this group is specified by means of the parameters above or below.
Well I tried the following:
c = canvas.canvas().layer("top")
t = canvas.canvas().layer("bot", below="top")
t = canvas.canvas().layer("bot", below=c)
t = canvas.canvas().layer("bot", below=0)
They all return with some error. For example the string version:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pyx/canvas.py", line 296, in layer
group, layer = name.split(".", 1)
ValueError: not enough values to unpack (expected 2, got 1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "EdgeRefining/refine_edges.py", line 174, in <module>
t = canvas.canvas().layer("bot", below="top")
File "/usr/lib/python3/dist-packages/pyx/canvas.py", line 312, in layer
self.items.insert(self.items.index(self.layers[below]), self.layers[name])
KeyError: 'top'
Has anyone used this functionality?