How do you hijack keyboard controls in Jupyter using Julia?



Let’s say you’re building a game in Jupyter using Julia.

Eventually, you’ll need to use the arrow keys to move something around a maze (or play 2048)

What is the best way to highjack keyboard controls?

The idea would be that:

  • some HTML is already rendered and
  • anything keyboard related would end with a Javascript call

similar topics:

edit: would it also be possible to make the key press have a time limit?

// akin to DDR, Guitar Hero, or "Press 'X' to dodge!"


Jupyter’s interface is in Javascript, and you need Javascript to write new widgets or to do anything with the UI that goes outside the Jupyter message spec.


But how can javascript talk to julia?

Is this in the docs somewhere?

basically the julia version of:


Best answer would be to use the WebIO Julia Gizmo: