PyScript

Uses your system voice; voice and rate in settings.

Snapshot

≈ 2 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

PyScript is a framework for running Python scripts in a web browser. PyScript was presented to the public by Peter Wang at a Python developer conference in June 2022. PyScript is primarily developed by Anaconda, Inc.

PyScript is a framework for running Python scripts in a web browser. PyScript was presented to the public by Peter Wang at a Python developer conference in June 2022. PyScript is primarily developed by Anaconda, Inc. PyScript: What time is it? What time is it? from pyscript import when, display from datetime import datetime @when("click", "#btnTime") def click_handler(event): now = datetime.now() display( now.strftime( "Today is %m/%d/%Y. " + "The current time is %I:%M:%S %p." ) ) As an alternative to , the element can also be used (as in the example below). However, the new notation is recommended. PyScript also offers the possibility to communicate with the user via a command prompt. For this, the terminal attribute must be added to the or element. If input should also be possible, the worker attribute must be specified as well. In earlier versions, a terminal could also be implemented using the element. PyScript: Bar chart packages = ["matplotlib"] import matplotlib.pyplot as plt from pyscript import display fig, ax = plt.subplots() x = ["Apples", "Pears", "Bananas", "Pineapples"] y = [3, 7, 8, 10] plt.bar(x, y) plt.xlabel('Fruits') plt.ylabel('Popularity') plt.title('Fruits and their popularity') fig display(fig, target="mpl") In order to create such diagrams, the matplotlib extension must be loaded in a block.

Text derived from https://en.wikipedia.org/w/index.php?oldid=1371681643 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

11 named source(s) extracted from the cited revision. A source with no author is shown by its publication; nothing is invented.