Skip to content

count_widget

frog.gui.measure_script.count_widget ¤

Provides a widget with a labelled QSpinBox.

Used in ScriptEditDialog in a couple of places.

Classes¤

CountWidget(label, initial_count=1) ¤

Bases: QWidget

A widget with labelled QSpinBox.

Create a new CountWidget.

Parameters:

Name Type Description Default
label str

A string label for the control

required
initial_count int

The initial value of the QSpinBox

1
Source code in frog/gui/measure_script/count_widget.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def __init__(self, label: str, initial_count: int = 1) -> None:
    """Create a new CountWidget.

    Args:
        label: A string label for the control
        initial_count: The initial value of the QSpinBox
    """
    super().__init__()

    self.count = QSpinBox()
    self.count.setMinimum(1)
    self.count.setMaximum(9999)
    self.count.setValue(initial_count)

    layout = QFormLayout()
    layout.addRow(f"{label}:", self.count)
    self.setLayout(layout)
Functions¤
value() ¤

Get the value of the QSpinBox.

Source code in frog/gui/measure_script/count_widget.py
30
31
32
def value(self) -> int:
    """Get the value of the QSpinBox."""
    return self.count.value()