Enable writing JupyterLab plugins using Flexx.
At the moment, this needs bleeding edge versions of Flexx (and also Jupyterlab?).
- Download or clone the source from Github.
pip install -e .
flexxlab enableto set things up.flexxlab add flexx.ui.examples.mondriaan.Mondriaanis one example.flexxlab add my.module.MyModelSubclassto use your own Flexx widget.jupyter labas usual.
- Use
flexxlab enableto set things up. After updating Flexx, you'll want to run this again to install the latestflexx-core.jsinto Jupyterlab. - Use
flexxlab disableto turn it all off again. - Use
flexxlab add x.y.MyModelto register a Flexx Model/Widget as a plugin. - Use
flexxlab remove x.y.MyModelto turn individual plugins off.
Plugins are simply a subclass of flexx.app.Model or flexx.ui.Widget.
It should preferably have a jlab_activate() method in JS, and can also
implement JLAB_AUTOSTART and JLAB_REQUIRES. For example:
class MyPlugin(ui.Widget):
def init(self):
# Popluate the widget as usual
with ui.HBox():
self.labale1 = ui.Label(text='bla bla')
self.button1 = ui.Label(text='Press me')
ui.Widget(flex=1) # spacer
class JS:
JLAB_AUTOSTART = True
JLAB_REQUIRES = ['jupyter.services.file-browser',
'jupyter.services.document-registry']
def jlab_activate(self, lab, fb, dr):
self.title = 'Flexx foo demo'
# Use fb (file browser) and dr (document registry) ...See https://github.com/zoofIO/flexxlab/tree/master/flexxlab/examples for more examples. See the Flexx documentations to learn more about creating widgets with Flexx.