diff --git a/ltk/widgets.py b/ltk/widgets.py index 4e7706f..8b3990b 100644 --- a/ltk/widgets.py +++ b/ltk/widgets.py @@ -95,7 +95,7 @@ def debug(self, *args): if self.DEBUG: print(self.__class__.__name__, *args) - def _bind(self, attribute): + def bind(self, attribute): """ Establish a binding between this Widget and a model """ def set_model_value(_=None): attribute.set_value(self.get_value()) @@ -104,13 +104,14 @@ def set_widget_value(_=None): self.set_value(attribute.get_value()) set_widget_value() + self.addClass(f"ltk-model-{attribute.model.__class__.__name__.lower()}-{attribute.name}") attribute.listeners.append(set_widget_value) self.on("change", proxy(lambda event: schedule(set_model_value, f"set model {self}"))) def set_value(self, value): """ Set the value of the widget. """ if isinstance(value, ModelAttribute): - self._bind(value) + self.bind(value) else: self._set_value(value) diff --git a/pyproject.toml b/pyproject.toml index afa4e85..8fed0a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyscript-ltk" -version = "0.2.4" +version = "0.2.5" description = "A little toolkit for writing UIs in PyScript" readme = "README.md" authors = [{ name = "Chris Laffra", email = "chris@chrislaffra.com" }]