Skip to content

Commit 1032f8d

Browse files
authored
make control a cooperative object (#490)
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/
1 parent 8897090 commit 1032f8d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sdk/python/flet/control.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def __init__(
100100
disabled: Optional[bool] = None,
101101
data: Any = None,
102102
):
103+
super().__init__()
103104
self.__page: Optional[Page] = None
104105
self.__attrs = {}
105106
self.__previous_children = []

0 commit comments

Comments
 (0)