A Bokeh on screen gesture/mouse drag based joystick widget for use in a dashboard with controls
Project description
Bokeh Joystick Widget
This is a custom widget for the Python Bokeh library that allows you to control a joystick via mouse drags or touch gestures.
The widget has x and y properties that are updated as the joystick is moved. The x and y properties are in the range -100 to 100.
The widget makes use of https://github.com/bobboteck/JoyStick/.
Setup
Install with pip:
pip install bokeh-joystick-widget
Or poetry:
poetry add bokeh-joystick-widget
Usage
In your bokeh app, you can use the joystick widget like this:
from bokeh_joystick_widget import JoystickWidget
:
# some plot
:
joystick = JoystickWidget()
joystick.on_change("position", lambda attr, old, new: print(f'x: {new["x"]}, y: {new["y"]}'))
:
:
show(column(joystick, plot))
Examples
There are two examples:
- examples/static_joystick_example.py - show a column with a plot and the joystick, then exit.
- examples/console_joystick_example.py - show a plot and the joystick in a bokeh server app. Callbacks from the front end drive console logs of the joystick position.
Roadmap
- Get the example JS demo widget/bokeh model to work - whatever that widget is. - done
- Figure out how to get values back to the python end with it. - done
- Figure out how to swap their control for the joystick (however hacky) - done
- Note - this is a TS file from the original, adapted here. The DOM element change is important.
- Figure out how to make that tidier. - done
- Figure out how to publish to PyPi (alpha) and test in a pip installed test.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for bokeh_joystick_widget-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b44e481f369c55d68bfd2202914cd393acf59407f5191e752dcaccbb955ec935 |
|
MD5 | 95861aa7d5f1a57a879c78298c133292 |
|
BLAKE2b-256 | 4bc63c6ba2e9436e5882f7841ba5fac372985c32bbe95652ad64dfae93b6f9e3 |
Close
Hashes for bokeh_joystick_widget-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61542b8e52c8d001c9bbce911aa5132b600cf56dc7d862b79d92982c21090336 |
|
MD5 | 9b07628e0826732d080304e968a9d7cd |
|
BLAKE2b-256 | b221220832f2f5b9a02810df840bf6b96433771d1ca2590f1fbcedda3b9818f0 |