From e5a622ff3052fb9dc421e52637767e534ec80290 Mon Sep 17 00:00:00 2001 From: linkfrg Date: Thu, 1 Aug 2024 01:25:54 +0500 Subject: [PATCH] docs: add setup property description --- docs/widgets/index.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/widgets/index.rst b/docs/widgets/index.rst index c4b84c1e..77b7f8db 100644 --- a/docs/widgets/index.rst +++ b/docs/widgets/index.rst @@ -21,6 +21,21 @@ but you can now pass a string with the actual value of the enum: ``"start"``, `` Overridden properties do not support enums. For example, you cannot pass an enum to the ``valign`` property. +The ``setup`` property +-------------------- +You can pass a callback function to the widget costructor as the ``setup`` property. +The widget will be passed to the callback function as an argument. +This can be useful when you need to perform actions when the widget is initialized (for example, connect to signal). + +.. code-block:: python + + from ignis.widgets import Widget + + Widget.Label( + label="you will not see this text", + setup=lambda self: self.set_label("instead, you will see this") + ) + Common widget properties -------------------------