From 7b9ad19674be18ade4e1241da32f99d035ef9a87 Mon Sep 17 00:00:00 2001 From: Nicky van Foreest <1683321+ndvanforeest@users.noreply.github.com> Date: Mon, 17 Oct 2022 21:29:25 +0200 Subject: [PATCH] make control a cooperative object I used the observer pattern to propagate changes in a usercontrol object. For that purpose my widget derives from UserControl and another class. Calling super().__init__() in my class did not work because I had the wrong order in the class calls, i.e., class MyWidget(UserControl, Subject), rather than class MyWidget(Subject, UserControl). By including super().__init__() in the Control class such points of confusion are easy to prevent. Here is a further discussion: https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ --- sdk/python/flet/control.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/python/flet/control.py b/sdk/python/flet/control.py index 7550f8dfa..0cc8e0403 100644 --- a/sdk/python/flet/control.py +++ b/sdk/python/flet/control.py @@ -100,6 +100,7 @@ def __init__( disabled: Optional[bool] = None, data: Any = None, ): + super().__init__() self.__page: Optional[Page] = None self.__attrs = {} self.__previous_children = []