Interacting with the Jupyter widgets

70 views
Skip to first unread message

Christopher Brooks

unread,
Aug 5, 2016, 5:13:46 PM8/5/16
to Project Jupyter
Hi,

I'm looking to interact with the jupyter notebook pages in javascript, largely to do things like send key commands. I've spent a bit of time going through the variety of bindings, but I can't see where I could actually raise a keypress/keydown event such that it would trigger KeyboardManager.prototype.bind_events.

Any hints on where I should be looking? My javascript's gotten a bit rusty :)

Chris

MinRK

unread,
Aug 9, 2016, 10:10:18 AM8/9/16
to Project Jupyter
May I ask what keypresses do you want to trigger, and why? Since keyboard shortcuts are customizable, triggering a keypress in command mode can take an arbitrarily different action from the default behavior, so perhaps calling the js APIs that those keypresses correspond to is the right approach, rather than triggering events that may or may not do what you want.

-MinRK

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/2cdbafa4-7fb4-47bf-89d9-02b1e6bb9549%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christopher Brooks

unread,
Aug 9, 2016, 10:35:48 AM8/9/16
to jup...@googlegroups.com
I actually want to automate the typing of the content out based on a script - I won't be in command mode at the time.

Regards,

Chris

--
You received this message because you are subscribed to a topic in the Google Groups "Project Jupyter" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jupyter/f5WcGrvbKvQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Christopher Brooks
Research Assistant Professor, School of Information
Director of Learning Analytics & Research, Office of Academic Innovation


School of Information
University of Michigan
4439 North Quad
105 S. State St.
Ann Arbor, MI 48109-1285

Jonathan Frederic

unread,
Aug 10, 2016, 11:05:56 PM8/10/16
to jup...@googlegroups.com
Chris,

Like Min suggests, you'll want to invoke actions instead of emulating keyboard commands.  Similarly, when interacting with widgets and cells, you'll want to invoke the native methods of the objects to set content.  IIRC for a cell it's something like 

cell.set_value('#Cell content') 

- use the web console to find the exact method name.  For widgets 

widgetView.model.set('value', 'something');
widgetView.touch();

There isn't a way to invoke keyboard/mouse click events on cells&widgets that works universally.

Best,
Jon

Reply all
Reply to author
Forward
0 new messages