Giter Site home page Giter Site logo

davidbrochart / idom Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reactive-python/reactpy

0.0 2.0 0.0 2.42 MB

Serve up interactive user interfaces with Python

Home Page: https://mybinder.org/v2/gh/rmorshea/idom/master?filepath=examples%2Fintroduction.ipynb

License: MIT License

HTML 0.93% JavaScript 14.05% CSS 0.05% Python 82.92% Shell 0.79% Makefile 0.54% Batchfile 0.73%

idom's Introduction

IDOM

Build Status Version Info License: MIT

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

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

At a Glance

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

import idom

@idom.element
async def Slideshow(self, index=0):

    async def next_image(event):
        self.update(index + 1)

    url = f"https://picsum.photos/800/300?image={index}"
    return idom.html.img({"src": url, "onClick": next_image})

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!

idom.display("jupyter", "https://localhost:8765/stream")

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

idom's People

Contributors

rmorshea avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.