mwcraig / ipyevents

A custom widget for returning mouse and keyboard events to Python. Documentation:
https://ipyevents.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
112 stars 27 forks source link

Using ipyevents on a remote (jupyter notebook) server #58

Closed kvinicki closed 3 years ago

kvinicki commented 3 years ago

Hi, I tried working with ipyevents widgets in a jupyter notebook that is running on a remote machine, but it doesn't react to DOM events. Can this problem be solved?

kvinicki commented 3 years ago

Sorry, it was my bug

mwcraig commented 3 years ago

No problem, I'm glad to hear you are using it!

olegsinavski commented 2 years ago

@kvinicki what was the bug exactly? I have a similar problem. The following demo doesn't work:

from ipywidgets import Label, HTML, HBox, Image, VBox, Box, HBox
from ipyevents import Event 
from IPython.display import display
l = Label('Click or type on me!')
l.layout.border = '2px solid red'

h = HTML('Event info')
d = Event(source=l, watched_events=['click', 'keydown', 'mouseenter', 'touchmove'])

def handle_event(event):
    print('a')
    lines = ['{}: {}'.format(k, v) for k, v in event.items()]
    content = '<br>'.join(lines)
    h.value = content

d.on_dom_event(handle_event)

display(l, h)
kvinicki commented 2 years ago

If I remember correctly, I installed ipyevents with pip, abd i had to stsrt jupyter server again in order for it to work

On Tue, Nov 9, 2021, 13:30 Oleg Sinavski @.***> wrote:

@kvinicki https://github.com/kvinicki what was the bug exactly? I have a similar problem. The following demo doesn't work:

from ipywidgets import Label, HTML, HBox, Image, VBox, Box, HBox from ipyevents import Event from IPython.display import display l = Label('Click or type on me!') l.layout.border = '2px solid red'

h = HTML('Event info') d = Event(source=l, watched_events=['click', 'keydown', 'mouseenter', 'touchmove'])

def handle_event(event): print('a') lines = ['{}: {}'.format(k, v) for k, v in event.items()] content = '
'.join(lines) h.value = content

d.on_dom_event(handle_event)

display(l, h)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mwcraig/ipyevents/issues/58#issuecomment-964108469, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISF7EBP4W67XZOKGZMP4ODULEH67ANCNFSM4TH5XJ4A .

mwcraig commented 2 years ago

Feel free to reopen (or to open a new issue) if it isn't working for you @olegsinavski