Skip to content

Conversation

@pushfoo
Copy link
Member

@pushfoo pushfoo commented Oct 14, 2025

Per Discord discussion with @DragonMoffon:

Please can we. its also super useful non daemon threads. If i have a worker thread open for file IO having it close if it catches a no window error would be great
also a does_window_exist function would be nice

The function name is have_window in this PR but otherwise it's the same idea.

Changes:

  1. Add arcade.exceptions.NoArcadeWindowError
    • subclasses RuntimeError
    • no args, just a semantic wrapper
  2. In arcade.window_commands:
    • Make get_window() raise NoArcadeWindowError when no window exists
    • Touch up old-style :returns: docstring for get_window()

Deferred until a later PR:

  • Add has_window() somewhere
    • has/have bikeshedding
    • window_commands may be worth moving (especially if we add multi-window support?)

* Add NoArcadeWindowError subclassing RuntimeError

* Make arcade.window_commands.get_window() raise NoArcadeWindowError when no window exists

* Add arcade.window_commands.have_window() function

* Improve documentation of get_window() function
@pushfoo pushfoo force-pushed the add_no_window_exception branch from 62798ce to 6183cdf Compare October 14, 2025 23:40
@pushfoo pushfoo force-pushed the add_no_window_exception branch from 5d3d09b to 21420a8 Compare October 14, 2025 23:50
@pushfoo pushfoo changed the title Add NoArcadeWindowError and window_commands.have_window function Add NoArcadeWindowError subclassing RuntimeError Oct 15, 2025
@pushfoo pushfoo force-pushed the add_no_window_exception branch from 2c6df97 to c38ba19 Compare October 15, 2025 05:08
@pushfoo pushfoo force-pushed the add_no_window_exception branch from c38ba19 to c190b44 Compare October 15, 2025 05:09
Copy link
Collaborator

@DragonMoffon DragonMoffon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation comment has the wrong function name, but this is otherwise good

@Cleptomania Cleptomania merged commit d45476a into development Oct 15, 2025
8 checks passed
@pushfoo pushfoo deleted the add_no_window_exception branch October 16, 2025 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants