How to create an input box using py-script?

351 Views Asked by At

I want to create a box for a website where you can put integers or a float in html using py-script.

I tried using tkinter but it is removed from the Python standard library in the Pyodide distribution due to browser limitations.

1

There are 1 best solutions below

1
cclauss On
import contextlib

with contextlib.suppress(ImportError):
    from pyscript import window
    input = window.prompt

ints_or_floats = input("Please enter some ints or floats.")