Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
You can grab pre-release versions from PyPi. See the available versions from the
Arcade [PyPi Release History](https://pypi.org/project/arcade/#history) page.

## Unreleased

- Fixed an issue causing a crash when closing the window
- Added `Window.close` (bool) attribute indicating if the window is closed

## Version 3.2

- GUI
Expand Down
8 changes: 7 additions & 1 deletion arcade/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ def __init__(
gl_version = 3, 1
gl_api = "gles"

self.closed = False
"""Indicates if the window was closed"""
self.headless: bool = arcade.headless
"""If True, the window is running in headless mode."""

Expand Down Expand Up @@ -429,6 +431,7 @@ def run(self, view: View | None = None) -> None:

def close(self) -> None:
"""Close the Window."""
self.closed = True
super().close()
# Make sure we don't reference the window any more
set_window(None)
Expand Down Expand Up @@ -537,7 +540,10 @@ def _dispatch_frame(self, delta_time: float) -> None:
# we only need the modulus to keep time, if we didn't care
# it could be set to zero instead.
# ! This should maybe be fixed at 'self._draw_rate', discuss.
self.draw(self._accumulated_draw_time)

# In case the window close in on_update, on_fixed_update or input callbacks
if not self.closed:
self.draw(self._accumulated_draw_time)
self._accumulated_draw_time %= self._draw_rate

def _dispatch_updates(self, delta_time: float) -> None:
Expand Down
Loading