diff --git a/examples/desktop/image/image_cmap.py b/examples/desktop/image/image_cmap.py index 9a9f0d497..b7f7b39af 100644 --- a/examples/desktop/image/image_cmap.py +++ b/examples/desktop/image/image_cmap.py @@ -3,6 +3,7 @@ ============ Example showing simple plot creation and subsequent cmap change with Standard image from imageio. """ + # test_example = true import fastplotlib as fpl diff --git a/examples/desktop/image/image_rgb.py b/examples/desktop/image/image_rgb.py index f73077acf..2642962fd 100644 --- a/examples/desktop/image/image_rgb.py +++ b/examples/desktop/image/image_rgb.py @@ -3,6 +3,7 @@ ============ Example showing the simple plot creation with 512 x 512 2D RGB image. """ + # test_example = true import fastplotlib as fpl diff --git a/examples/desktop/image/image_rgbvminvmax.py b/examples/desktop/image/image_rgbvminvmax.py index 4891c5614..e5c4af531 100644 --- a/examples/desktop/image/image_rgbvminvmax.py +++ b/examples/desktop/image/image_rgbvminvmax.py @@ -3,6 +3,7 @@ ============ Example showing the simple plot followed by changing the vmin/vmax with 512 x 512 2D RGB image. """ + # test_example = true import fastplotlib as fpl diff --git a/examples/desktop/image/image_vminvmax.py b/examples/desktop/image/image_vminvmax.py index ae5d102fa..e764f6775 100644 --- a/examples/desktop/image/image_vminvmax.py +++ b/examples/desktop/image/image_vminvmax.py @@ -3,6 +3,7 @@ ============ Example showing the simple plot creation followed by changing the vmin/vmax with Standard imageio image. """ + # test_example = true import fastplotlib as fpl diff --git a/examples/desktop/image/image_widget.py b/examples/desktop/image/image_widget.py new file mode 100644 index 000000000..c50d914d3 --- /dev/null +++ b/examples/desktop/image/image_widget.py @@ -0,0 +1,20 @@ +""" +Image widget +============ +Example showing the image widget in action. +When run in a notebook, or with the Qt GUI backend, sliders are also shown. +""" + +import numpy as np +import fastplotlib as fpl +import imageio.v3 as iio # not a fastplotlib dependency, only used for examples + + +a = iio.imread("imageio:camera.png") +iw = fpl.widgets.ImageWidget(data=a, cmap="viridis") +iw.show() + + +if __name__ == "__main__": + print(__doc__) + fpl.run() diff --git a/fastplotlib/__init__.py b/fastplotlib/__init__.py index 98dc17e26..27545f0ad 100644 --- a/fastplotlib/__init__.py +++ b/fastplotlib/__init__.py @@ -4,19 +4,13 @@ from .graphics import * from .graphics.selectors import * from .legends import * +from .widgets import ImageWidget from .utils import _notebook_print_banner, config from wgpu.gui.auto import run - -try: - import ipywidgets -except (ModuleNotFoundError, ImportError): - pass -else: - from .widgets import ImageWidget - from wgpu.backends.wgpu_native import enumerate_adapters + with open(Path(__file__).parent.joinpath("VERSION"), "r") as f: __version__ = f.read().split("\n")[0]