Skip to content

Conversation

@ndvanforeest
Copy link
Contributor

I used the observer pattern to propagate changes in a usercontrol object. For that purpose my widget derives from UserControl and another class, called Subject. 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/

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/
@CLAassistant
Copy link

CLAassistant commented Oct 17, 2022

CLA assistant check
All committers have signed the CLA.

@FeodorFitsner
Copy link
Contributor

Interesting. Is that 'Subject' class your own? What problem were you solving? Is there something from your solution you can share with the rest of Flet community?

@ndvanforeest
Copy link
Contributor Author

ndvanforeest commented Oct 17, 2022 via email

@FeodorFitsner
Copy link
Contributor

Got it, thanks!

@FeodorFitsner FeodorFitsner merged commit 1032f8d into flet-dev:main Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants