Skip to content

Using with napari#

If you want a nice GUI to interact with in addition to being able to script you can use napari-micromanager which implements a GUI in napari using this library as a backend.

Launching napari from a script#

For complex scripting you likely will want to launch napari from a script or a jupyter notebook.

napari.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import napari

from pymmcore_plus import CMMCorePlus

v = napari.Viewer()
dw, main_window = v.window.add_plugin_dock_widget("napari-micromanager")

# quick way to access the same core instance as napari-micromanager
mmc = CMMCorePlus.instance()

# do any complicated scripting you want here
...

# start napari
napari.run()

Using the integrated napari terminal#

After launching napari and starting the napari-micromanager plugin you can open the napari terminal and get a reference to the same core object that the plugin uses by running:

from pymmcore_plus import CMMCorePlus

mmc = CMMCorePlus.instance()