Skip to content

PresetsWidget

PresetsWidget widget

This image generated from example code below.

PresetsWidget #

Bases: QWidget

A Widget to create a QCombobox containing the presets of the specified group.

Parameters:

Name Type Description Default
group str

Group name.

required
parent QWidget | None

Optional parent widget. By default, None.

None
mmcore CMMCorePlus | None

Optional pymmcore_plus.CMMCorePlus micromanager core. By default, None. If not specified, the widget will use the active (or create a new) CMMCorePlus.instance.

None

allowedValues() -> tuple[str, ...] #

Return the allowed values for this widget.

setValue(value: str) -> None #

Set the combobox to the given value.

value() -> str #

Get current value.

Example#

presets_widget.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Example Usage of the PresetsWidget class.

In this example all the available groups created in micromanager
are displayed with a 'PresetsWidget'.
"""

from pymmcore_plus import CMMCorePlus
from qtpy.QtWidgets import QApplication, QFormLayout, QWidget

from pymmcore_widgets import PresetsWidget

app = QApplication([])

mmc = CMMCorePlus().instance()
mmc.loadSystemConfiguration()

wdg = QWidget()
wdg.setLayout(QFormLayout())

for group in mmc.getAvailableConfigGroups():
    gp_wdg = PresetsWidget(group)
    wdg.layout().addRow(f"{group}:", gp_wdg)

wdg.show()

app.exec_()