0

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.

2
  • 1
    Does this answer your question? How do you input and output text with Pyscript? Commented Nov 2, 2022 at 20:40
  • 2
    Use the HTML DOM elements such as <input>. Everything in PyScript is just a layer above the web browser DOM. Commented Nov 2, 2022 at 20:40

1 Answer 1

0
import contextlib

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

ints_or_floats = input("Please enter some ints or floats.")
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for this code snippet, which might provide some limited, immediate help. A proper explanation would greatly improve its long-term value by showing why this is a good solution to the problem and would make it more useful to future readers with other, similar questions. Please edit your answer to add some explanation, including the assumptions you’ve made.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.