Skip to content

reactive-python/reactpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a5e4401 · Jan 1, 2021
Dec 21, 2020
Dec 22, 2020
Jan 1, 2021
Dec 23, 2020
Dec 22, 2020
Jan 1, 2021
Jun 9, 2020
Jun 9, 2020
Oct 6, 2019
Mar 1, 2019
Jan 1, 2021
Oct 1, 2020
Dec 23, 2020
Jun 9, 2020
Dec 27, 2020
Jan 1, 2021

Repository files navigation

IDOM

Tests Code Coverage Version Info License: MIT

Libraries for creating and controlling interactive web pages with Python 3.7 and above.

Be sure to read the Documentation

IDOM is still young. If you have ideas or find a bug, be sure to post an issue or create a pull request. Thanks in advance!

Click the badge above to get started! It will take you to a Jupyter Notebooks hosted by Binder with some great examples.

Or Install it Now

pip install idom[stable]

At a Glance

IDOM can be used to create a simple slideshow which changes whenever a user clicks an image.

import idom

@idom.element
def Slideshow():
    index, set_index = idom.hooks.use_state(0)
    url = f"https://picsum.photos/800/300?image={index}"
    return idom.html.img({"src": url, "onClick": lambda event: set_index(index + 1)})

idom.run(Slideshow, port=8765)

Running this will serve our slideshow to "https://localhost:8765/client/index.html"

You can even display the same thing in a Jupyter Notebook, just use idom_jupyter:

import idom_jupyter
idom_jupyter.run(Slideshow)

Every click will then cause the image to change (it won't here of course).