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

Jupyter Lab: Throttling causes keyboard events to continue propagating #60

Open
lawruble13 opened this issue Nov 6, 2020 · 0 comments

Comments

@lawruble13
Copy link

When an event monitor is set up on keyboard events, if it's throttled the event isn't stopped from propagating. That results in this code

from IPython.display import display
from ipycanvas import Canvas
from ipyevents import Event

canvas = Canvas(width=500, height=48)

canvas.font = "32px serif"
canvas.fill_style = "black"
mon = Event(source=canvas, watched_events=['keyup', 'keydown'], wait = 1000//30)

def handle_event(event):
    global canvas
    if event['type'] == "keydown":
        canvas.clear()
        canvas.fill_text(f"last_pressed: {event['key']}", 0, 32)

mon.on_dom_event(handle_event)

display(canvas)

scrolling the notebook when the up or down arrow keys are pressed.

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 a pull request may close this issue.

1 participant