Skip to main content

Control the web with Python

Project description

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!

Try it Now Binder

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)})

server = idom.server.sanic.PerClientState(Slideshow)
server.daemon("localhost", 8765).join()

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

You could even display the same thing in a Jupyter notebook!

from idom.widgets.jupyter import init_display
display = init_display("127.0.0.1")
display(Slideshow)

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

Project details


Release history Release notifications | RSS feed

This version

0.9.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

idom-0.9.2-py3-none-any.whl (139.1 kB view details)

Uploaded Python 3

File details

Details for the file idom-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: idom-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 139.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for idom-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f7de1a9a8586b7d0b966a90d07335f03cd269cc3a27dcc696391cb5a8ed70565
MD5 79211b73ab5c5b521b71adcb5e54a9a3
BLAKE2b-256 a7ed0f0ee9ea42c2a85e68cc5a3a390d94ca12221a0a0be19ed5866034ded044

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page