checkbox.py 417 B

1234567891011121314
  1. from typing import Callable
  2. import justpy as jp
  3. from .element import Element
  4. from ..utils import handle_exceptions, provide_arguments
  5. class Checkbox(Element):
  6. def __init__(self, text: str, on_change: Callable = None):
  7. view = jp.QCheckbox(text=text)
  8. if on_change is not None:
  9. view.on('input', handle_exceptions(provide_arguments(on_change, 'value')))
  10. super().__init__(view)