Skip to content

Conversation

mathsvisualization
Copy link

Motivation

Currently, pressing certain system keys (like Win, PrtScr, or special key combinations) inside the interactive window causes an OverflowError: Python int too large to convert to C int. This fix prevents crashes by safely handling such cases, improving stability when working with InteractiveScene.

Proposed changes

  • Updated InteractiveScene.on_key_press:
    • Wrapped chr(symbol) in a try/except.
    • Catch OverflowError to avoid crashing when key symbols are too
      large.
  • Prevents the application from breaking during user interaction with
    special keys.

Test

Code:

from manimlib import *

class HelloWorldExample(InteractiveScene):
    def construct(self):
        pass

Result:

  • Run the above scene.
  • Press system keys like Win + PrtScr.
  • Before fix → application crashed with OverflowError.
  • After fix → application runs normally without crashing (large key
    symbols are ignored).

Before:

Screenshot (60)

After:

Screenshot (62)

@mathsvisualization mathsvisualization changed the title fix(interactive_scene): handle OverflowError in on_key_press for larg… fix(interactive_scene): handle OverflowError in on_key_press for large key symbols Oct 1, 2025
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