Events reference
The following tables contain events that you may connect to.
For example, to have a specific function called whenever the users
changes the number of dimensions displayed in the viewer (e.g.
from 2D to 3D), you can use <event>.connect(your_callback)
:
from napari.utils.events import Event
from napari import Viewer
def my_callback(event: Event):
print("The number of dims shown is now:", event.value)
viewer = Viewer()
viewer.dims.events.ndim.connect(my_callback)