Pirate Translator 🦜 💬 🇬🇧 ➡️ 🏴☠️
Run the app | View the code on GitHub
A simple PyScript application that translates English text into Pirate speak.
What it demonstrates
- Basic PyScript application structure (HTML, Python, configuration).
- Using
pyscript.webto interact with page elements. - Event handling with the
@whendecorator. - Installing and using third-party Python packages (arrr).
Files
index.html- The web page to display.main.py- Python code that handles the translation.pyscript.json- Configuration specifying required packages.
How it works
- User types English text into an input field.
- User clicks the "Translate" button.
- The
@whendecorator connects the button's click event totranslate_english. - Function retrieves the input text using
web.page["english"]. - Text is translated using the
arrrlibrary. - Result is displayed in the output div using
web.page["output"].