Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added on_resize method to widgets so their size can be changed after initialization #930

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

CORRUPTOR2037
Copy link

No description provided.

@matanox
Copy link
Contributor

matanox commented May 25, 2024

Currently Window.set_size has this line of code in it:

self.dispatch_event('on_resize', width, height)

Which means that when called by application code, it may directly steer the flow of control to an application registered callback handler for the on_resize event. This is not trivial for an application expecting its call to set_size to immediately return, whereas instead the next line of application code to execute will be that of its on_resize registered handler (which is a very awkward flow of control, even if applications can be written to safely manage this flow of control, IMHO).

I hope this PR avoids introducing or repeating this kind of unexpected opportunity for confluence of application code.

It's mildly related to #1116 in that the latter explains how Window.dispatch_event works in these regards.

That said, to counter my own, maybe people more immersed in design patterns for event driven applications find this type of confluence natural or beautiful; otherwise to the rest of us, it just entails more conditional logic in callbacks and a rather loopy analysis of the safety when callbacks interact.

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.

None yet

3 participants