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

Handle ctrl-c #25

Merged
merged 7 commits into from
Nov 21, 2024
Merged

Handle ctrl-c #25

merged 7 commits into from
Nov 21, 2024

Conversation

almarklein
Copy link
Member

@almarklein almarklein commented Nov 18, 2024

See pygfx/pygfx#377

Inspired mostly by https://github.com/encode/uvicorn/blob/master/uvicorn/server.py

Sending sigint will stop the event loop, if we're the one running it. These changes improve the behavior of the base loop implementation, so that the subclasses can actually be made quite a bit simpler.

  • Tested on MacOS
  • Tested on Windows
  • Tested on Linux

@almarklein almarklein merged commit ea67187 into main Nov 21, 2024
13 checks passed
@almarklein almarklein deleted the interrupt branch November 21, 2024 10:23
@almarklein
Copy link
Member Author

Interrupt (ctrl-c) simply calls loop.close(). This will first (attempt to) close all canvases. When all canvases are closed, the loop ends. If for some reason the windows do not close, one can close/interrupt called again to close the loop without closing the windows.

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.

1 participant