on_layer

BM.on_layer(func, layer=None, persistent=False, m=None)

Add callables that are executed whenever the visible layer changes.

NOTE: if m is None this function always falls back to the parent Maps-object!!

Parameters:

func (callable) –

The callable to use. The call-signature is:

>>> def func(m, layer):
>>>    # m     ... the Maps-object
>>>    # layer ... the name of the layer

layerstr or None, optional
  • If str: The function will only be called if the specified layer is activated.

  • If None: The function will be called on any layer-change.

The default is None.

persistentbool, optional

Indicator if the function should be called only once (False) or if it should be called whenever a layer is activated. The default is False.

meomaps.Maps

The Maps-object to pass as argument to the function execution. If None, the parent Maps-object is used.