File: drag_and_drop_python_code.py

package info (click to toggle)
napari 0.7.0~a3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 16,320 kB
  • sloc: python: 113,797; xml: 72; sh: 47; makefile: 43
file content (22 lines) | stat: -rw-r--r-- 500 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
Drag and Drop Python Code Example
=================================

This example demonstrates how to execute a python script by drag'n'drop

To use this example, open napari and drag this file into the viewer.

.. tags:: interactivity
"""
from napari import Viewer
from napari.types import ImageData


def add_layers(img1: ImageData, img2: ImageData) -> ImageData:
    return img1 + img2

viewer = Viewer()

viewer.open_sample('napari', 'cells3d')
viewer.window.add_function_widget(add_layers)