Skip to content

Prevent jupyter backend from submitting events that rendercanvas does not (yet) know #82

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

Merged
merged 1 commit into from
May 9, 2025
Merged
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
7 changes: 6 additions & 1 deletion rendercanvas/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import time

from .base import BaseCanvasGroup, BaseRenderCanvas
from ._events import EventType
from .asyncio import loop

import numpy as np
Expand All @@ -32,6 +33,7 @@ def __init__(self, *args, **kwargs):
self._logical_size = 0, 0
self._is_closed = False
self._draw_request_time = 0
self._rendercanvas_event_types = set(EventType)

# Set size, title, etc.
self._final_canvas_init()
Expand Down Expand Up @@ -115,7 +117,10 @@ def handle_event(self, event):
self._pixel_ratio = event["pixel_ratio"]
self._logical_size = event["width"], event["height"]

self.submit_event(event)
# Only submit events that rendercanvas known. Otherwise, if new events are added
# to jupyter_rfb that rendercanvas does not (yet) know, rendercanvas will complain.
if event_type in self._rendercanvas_event_types:
self.submit_event(event)


# Make available under a name that is the same for all backends
Expand Down