Skip to main content

Napari Toolkit

A napari toolkit for handling QWidgets to simplify the development of Napari plugins. The toolkit provides enhanced widgets, UI components, and utilities that streamline plugin creation, improve layout management, and enhance user interaction within the Napari ecosystem.

Installation

1. Install napari_toolkit

pip install napari-toolkit

or clone the repository:

git clone https://github.com/MIC-DKFZ/napari_toolkit.git
cd napari_toolkit
pip install -e ./

Qt bindings

napari_toolkit supports both PyQt5 and PySide6 through qtpy; its public API is the same for either binding. Existing PyQt5 projects continue to work unchanged. If an application does not already install a Qt binding, choose one explicitly:

pip install "napari-toolkit[pyqt5]"   # existing PyQt5 applications
pip install "napari-toolkit[pyside6]" # PySide6 applications

Only one Qt binding should be active in a process. If both are installed, select the intended one before importing napari, qtpy, or napari_toolkit:

QT_API=pyside6 python your_app.py

2. (Optional) Initialize your Plugin

Afterward it is recommended to generate you plugin with copier using the napari-plugin-template.


Gallery

from napari_toolkit.widget_gallery import show_widget_gallery
show_widget_gallery()

Widgets

from napari_toolkit.widgets import (setup_acknowledgements, setup_checkbox, setup_colorbar,
                                    setup_colorpicker, setup_combobox, setup_dirselect,
                                    setup_doubleslider, setup_doublespinbox, setup_editcolorpicker,
                                    setup_editdoubleslider, setup_editslider, setup_fileselect,
                                    setup_hswitch, setup_icon_wrapper, setup_iconbutton,
                                    setup_label, setup_labeleddoubleslider, setup_labeledslider,
                                    setup_layerselect, setup_lineedit, setup_plaintextedit,
                                    setup_progressbar, setup_progressbaredit, setup_pushbutton,
                                    setup_radiobutton, setup_savefileselect, setup_slider,
                                    setup_spinbox, setup_textedit, setup_timeedit,
                                    setup_togglebutton, setup_vswitch)

Buttons

  • QPushButton: A standard clickable button that can trigger an action.
  • QRadioButton: A radio button for selecting one option in a group.
  • QToggleButton: A clickable button that toggles between an "on" and "off" state.
  • IconButton: A QPushButton with an Icon.

Spinbox

  • QSpinBox: A numerical input field allowing integer selection with up/down arrows.
  • QDoubleSpinBox: A spinbox similar to QSpinBox but supports floating-point numbers.

Slider

  • QSlider: A horizontal or vertical slider for selecting an integer value.
  • QDoubleSlider: A slider that supports floating-point values instead of integers.
  • QLabeledSlider: A QSlider combined with a QLabel to display the value.
  • QLabeledDoubleSlider: A QFloatSlider with an accompanying QLabel to show the selected value.
  • QEditSlider: A QSlider paired with an editable text box for precise input.
  • QEditDoubleSlider: A QFloatSlider paired with an editable text box for precise input.

Progressbar

  • QProgressBar: A visual progress indicator that displays completion percentage.
  • QProgressbarEdit: A QProgressBar with an editable field for manual updates.

Text Edit

  • QLabel: A non-editable text display widget.
  • QLineEdit: A single-line text input field.
  • QTextEdit: A multi-line text editor with rich-text support
  • QPlainTextEdit: A multi-line text editor optimized for plain text input.

Switch

  • QVSwitch: A vertical switch that toggles between multiple states.
  • QHSwitch: A horizontal switch that toggles between multiple states.

QComboBox

  • QComboBox: A dropdown menu for selecting one option from a list.

Checkbox

  • QCheckBox: A selectable box that toggles between checked and unchecked states.

Color

  • Colorbar: A widget displaying a colorbar.
  • QColorPicker: A dialog for selecting colors.
  • QEditColorPicker:A dialog for selecting colors, combined with a textfield and slider for changing efficiently rgba values.

QLayerSelect

  • QLayerSelect: A dropdown or list for selecting a specific layer type (Labels, Images,...) in the Napari Viewer.

File/Dir Select

  • QFileSelect: A file selection dialog to choose a file.
  • QFileSelect(save directory): A file selection dialog specifically for saving directories.
  • QDirSelect: A directory selection dialog.

QTimeEdit

  • QDateTimeEdit: A widget for selecting and editing date and time values.

Containers

from napari_toolkit.containers import (setup_hgroupbox, setup_scrollarea, setup_tabwidget,
                                       setup_vcollapsiblegroupbox)
  • QGroupBox: A container with a title for grouping related widgets.
  • QCollapsableGroupBox: A QGroupBox that can be expanded or collapsed to show/hide content.
  • QScrollArea: A container that allows scrolling when content exceeds available space.
  • QTabWidget: A widget with multiple tabs for organizing content.

Data Struct

from napari_toolkit.data_structs import setup_list, setup_table, setup_tree
  • QListWidget: A list-based widget that allows displaying and managing a list of items.
  • QTableWidget: A table-based widget that provides an editable grid of rows and columns, commonly used for structured data representation.
  • QTreeWidget: A hierarchical tree-based widget that enables organizing data in expandable and collapsible parent-child relationships.

Widget Value Handling

Easily get and set values for QWidgets in your Napari plugin. Note: These functions work for many widgets but are not guaranteed to support all

from napari_toolkit.utils.widget_getter import get_value
from napari_toolkit.utils.widget_setter import set_value

set_value(<QWidget>,<value>)        # Sets the value of widget
_ = get_value(<QWidget>,<value>)    # Retrieves the value of a widget

Acknowledgments

    

This repository is developed and maintained by the Applied Computer Vision Lab (ACVL) of Helmholtz Imaging.

This napari plugin was generated with copier using the napari-plugin-template.

Metadata

Release files for napari-toolkit 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for napari-toolkit 0.0.10
File Size Uploaded Provenance
napari_toolkit-0.0.10.tar.gz 108.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for napari-toolkit 0.0.10
File Interpreter ABI Platform
napari_toolkit-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 234.6 kB

Release files / napari_toolkit-0.0.10.tar.gz

Download URL napari_toolkit-0.0.10.tar.gz
Size 108.6 kB
Tags Source
SHA-256 checksum
How to use checksums
447f23dde1cd99307c65703405d9962ff7471cf682a50e1d6f0538f4a5756453
BLAKE2b-256 checksum
How to use checksums
7b0866b60aac172d5e1d547fa42706ff25747fc8ace0ad3e86b4ad0f19535f58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / napari_toolkit-0.0.10-py3-none-any.whl

Download URL napari_toolkit-0.0.10-py3-none-any.whl
Size 126.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cf0d24fad348a93cf710dab7877c556f9fbfde62b27872f38bc3e189582450c
BLAKE2b-256 checksum
How to use checksums
de56f60b7f288247f00fd88cc7651ca9b0c06969ec40911befca02f3fc6bde4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for napari-toolkit 0.0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page