├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .gitpod.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── MANIFEST.in ├── Makefile ├── Makefile.bat ├── README.md ├── VERSION ├── bin └── check_license.sh ├── dev-requirements.txt ├── docs ├── examples │ ├── index.md │ ├── pyodide │ │ ├── bouncing │ │ │ ├── bouncing.py │ │ │ ├── bouncingFPS.py │ │ │ ├── index.html │ │ │ ├── odkaz.txt │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── breakout │ │ │ ├── breakout-kb.py │ │ │ ├── breakout-ms.py │ │ │ ├── breakout.py │ │ │ ├── index.html │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── flappybird │ │ │ ├── flappybird.py │ │ │ ├── images │ │ │ │ ├── background.png │ │ │ │ ├── bird1.png │ │ │ │ ├── bird2.png │ │ │ │ ├── birddead.png │ │ │ │ ├── bottom.png │ │ │ │ └── top.png │ │ │ ├── index.html │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── index.html.template │ │ ├── memory │ │ │ ├── LICENCE │ │ │ ├── README.md │ │ │ ├── images │ │ │ │ ├── card_back.png │ │ │ │ ├── checkmark-old.png │ │ │ │ ├── checkmark.png │ │ │ │ ├── im1.png │ │ │ │ ├── im2.png │ │ │ │ ├── im3.png │ │ │ │ ├── im4.png │ │ │ │ ├── im5.png │ │ │ │ ├── im6.png │ │ │ │ └── steve.png │ │ │ ├── index.html │ │ │ ├── memory.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── mines │ │ │ ├── images │ │ │ ├── images30 │ │ │ │ ├── blank.png │ │ │ │ ├── cover.png │ │ │ │ ├── eight.png │ │ │ │ ├── five.png │ │ │ │ ├── flag.png │ │ │ │ ├── four.png │ │ │ │ ├── mine.png │ │ │ │ ├── one.png │ │ │ │ ├── red.png │ │ │ │ ├── seven.png │ │ │ │ ├── six.png │ │ │ │ ├── three.png │ │ │ │ └── two.png │ │ │ ├── images60 │ │ │ │ ├── blank.png │ │ │ │ ├── cover.png │ │ │ │ ├── eight.png │ │ │ │ ├── five.png │ │ │ │ ├── flag.png │ │ │ │ ├── four.png │ │ │ │ ├── mine.png │ │ │ │ ├── one.png │ │ │ │ ├── red.png │ │ │ │ ├── seven.png │ │ │ │ ├── six.png │ │ │ │ ├── three.png │ │ │ │ └── two.png │ │ │ ├── index.html │ │ │ ├── mines.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── pong │ │ │ ├── index.html │ │ │ ├── pong.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── samegame │ │ │ ├── index.html │ │ │ ├── samegame.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_001 │ │ │ ├── index.html │ │ │ ├── sketch_001.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_002 │ │ │ ├── index.html │ │ │ ├── sketch_002.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_003 │ │ │ ├── index.html │ │ │ ├── sketch_003.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_004 │ │ │ ├── index.html │ │ │ ├── sketch_004.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_005 │ │ │ ├── index.html │ │ │ ├── sketch_005.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_006 │ │ │ ├── index.html │ │ │ ├── sketch_006.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_007 │ │ │ ├── index.html │ │ │ ├── sketch_007.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_008 │ │ │ ├── index.html │ │ │ ├── sketch_008.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_009 │ │ │ ├── alien.png │ │ │ ├── index.html │ │ │ ├── rainbow.png │ │ │ ├── sketch_009.py │ │ │ ├── smile.png │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_010 │ │ │ ├── index.html │ │ │ ├── sketch_010.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ ├── sketch_011 │ │ │ ├── index.html │ │ │ ├── sketch_011.py │ │ │ ├── static │ │ │ │ └── p5.js │ │ │ └── target │ │ │ │ └── target_sketch.js │ │ └── sketch_012 │ │ │ ├── index.html │ │ │ ├── sketch_012.py │ │ │ ├── static │ │ │ └── p5.js │ │ │ └── target │ │ │ └── target_sketch.js │ ├── sketch_000 │ │ ├── index.html │ │ ├── sketch_000.py │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── pyp5js.python_functions.js │ │ │ ├── pyp5js.python_functions.py │ │ │ ├── sketch_000.js │ │ │ ├── sketch_000.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ └── transcrypt │ │ ├── index.html.template │ │ ├── sketch_001 │ │ ├── index.html │ │ ├── sketch_001.py │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── python_functions.js │ │ │ ├── python_functions.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ │ ├── sketch_002 │ │ ├── index.html │ │ ├── sketch_002.py │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── python_functions.js │ │ │ ├── python_functions.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ │ ├── sketch_003 │ │ ├── index.html │ │ ├── sketch_003.py │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── python_functions.js │ │ │ ├── python_functions.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ │ ├── sketch_004 │ │ ├── index.html │ │ ├── sketch_004.py │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── python_functions.js │ │ │ ├── python_functions.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ │ ├── sketch_005 │ │ ├── index.html │ │ ├── sketch_005.py │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── python_functions.js │ │ │ ├── python_functions.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ │ ├── sketch_006 │ │ ├── index.html │ │ ├── sketch_006.py │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── python_functions.js │ │ │ ├── python_functions.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ │ ├── sketch_007 │ │ ├── index.html │ │ ├── sketch_007.py │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── python_functions.js │ │ │ ├── python_functions.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ │ ├── sketch_008 │ │ ├── index.html │ │ ├── sketch_008.py │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── python_functions.js │ │ │ ├── python_functions.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ │ ├── sketch_009 │ │ ├── alien.png │ │ ├── index.html │ │ ├── rainbow.png │ │ ├── sketch_009.py │ │ ├── smile.png │ │ ├── static │ │ │ └── p5.js │ │ └── target │ │ │ ├── math.js │ │ │ ├── math.py │ │ │ ├── org.transcrypt.__runtime__.js │ │ │ ├── org.transcrypt.__runtime__.py │ │ │ ├── pyp5js.js │ │ │ ├── pyp5js.py │ │ │ ├── python_functions.js │ │ │ ├── python_functions.py │ │ │ ├── random.js │ │ │ ├── random.py │ │ │ ├── target_sketch.js │ │ │ ├── target_sketch.project │ │ │ └── target_sketch.py │ │ └── sketch_010 │ │ ├── index.html │ │ ├── sketch_010.py │ │ ├── static │ │ └── p5.js │ │ └── target │ │ ├── org.transcrypt.__runtime__.js │ │ ├── org.transcrypt.__runtime__.py │ │ ├── pyp5js.js │ │ ├── pyp5js.py │ │ ├── python_functions.js │ │ ├── python_functions.py │ │ ├── target_sketch.js │ │ ├── target_sketch.project │ │ └── target_sketch.py ├── index.md └── pyodide │ ├── afterBody.js │ ├── index.html │ ├── index.html.template │ ├── pyodide.py │ ├── share.js │ ├── styles.css │ └── target │ └── target_sketch.js ├── pyp5js ├── __init__.py ├── cli.py ├── commands.py ├── compiler.py ├── config │ ├── __init__.py │ ├── fs.py │ └── sketch.py ├── exceptions.py ├── http_local │ ├── __init__.py │ ├── static │ │ ├── js │ │ │ ├── ace │ │ │ │ ├── ace.js │ │ │ │ ├── ext-beautify.js │ │ │ │ ├── ext-code_lens.js │ │ │ │ ├── ext-elastic_tabstops_lite.js │ │ │ │ ├── ext-emmet.js │ │ │ │ ├── ext-error_marker.js │ │ │ │ ├── ext-keybinding_menu.js │ │ │ │ ├── ext-language_tools.js │ │ │ │ ├── ext-linking.js │ │ │ │ ├── ext-modelist.js │ │ │ │ ├── ext-options.js │ │ │ │ ├── ext-prompt.js │ │ │ │ ├── ext-rtl.js │ │ │ │ ├── ext-searchbox.js │ │ │ │ ├── ext-settings_menu.js │ │ │ │ ├── ext-spellcheck.js │ │ │ │ ├── ext-split.js │ │ │ │ ├── ext-static_highlight.js │ │ │ │ ├── ext-statusbar.js │ │ │ │ ├── ext-textarea.js │ │ │ │ ├── ext-themelist.js │ │ │ │ ├── ext-whitespace.js │ │ │ │ ├── keybinding-emacs.js │ │ │ │ ├── keybinding-sublime.js │ │ │ │ ├── keybinding-vim.js │ │ │ │ ├── keybinding-vscode.js │ │ │ │ ├── mode-python.js │ │ │ │ ├── theme-ambiance.js │ │ │ │ ├── theme-chaos.js │ │ │ │ ├── theme-chrome.js │ │ │ │ ├── theme-clouds.js │ │ │ │ ├── theme-clouds_midnight.js │ │ │ │ ├── theme-cobalt.js │ │ │ │ ├── theme-crimson_editor.js │ │ │ │ ├── theme-dawn.js │ │ │ │ ├── theme-dracula.js │ │ │ │ ├── theme-dreamweaver.js │ │ │ │ ├── theme-eclipse.js │ │ │ │ ├── theme-github.js │ │ │ │ ├── theme-gob.js │ │ │ │ ├── theme-gruvbox.js │ │ │ │ ├── theme-idle_fingers.js │ │ │ │ ├── theme-iplastic.js │ │ │ │ ├── theme-katzenmilch.js │ │ │ │ ├── theme-kr_theme.js │ │ │ │ ├── theme-kuroir.js │ │ │ │ ├── theme-merbivore.js │ │ │ │ ├── theme-merbivore_soft.js │ │ │ │ ├── theme-mono_industrial.js │ │ │ │ ├── theme-monokai.js │ │ │ │ ├── theme-nord_dark.js │ │ │ │ ├── theme-pastel_on_dark.js │ │ │ │ ├── theme-solarized_dark.js │ │ │ │ ├── theme-solarized_light.js │ │ │ │ ├── theme-sqlserver.js │ │ │ │ ├── theme-terminal.js │ │ │ │ ├── theme-textmate.js │ │ │ │ ├── theme-tomorrow.js │ │ │ │ ├── theme-tomorrow_night.js │ │ │ │ ├── theme-tomorrow_night_blue.js │ │ │ │ ├── theme-tomorrow_night_bright.js │ │ │ │ ├── theme-tomorrow_night_eighties.js │ │ │ │ ├── theme-twilight.js │ │ │ │ ├── theme-vibrant_ink.js │ │ │ │ ├── theme-xcode.js │ │ │ │ ├── worker-coffee.js │ │ │ │ ├── worker-css.js │ │ │ │ ├── worker-html.js │ │ │ │ ├── worker-javascript.js │ │ │ │ ├── worker-json.js │ │ │ │ ├── worker-lua.js │ │ │ │ ├── worker-php.js │ │ │ │ ├── worker-xml.js │ │ │ │ └── worker-xquery.js │ │ │ ├── p5 │ │ │ │ ├── addons │ │ │ │ │ ├── p5.sound.js │ │ │ │ │ └── p5.sound.min.js │ │ │ │ ├── p5.js │ │ │ │ └── p5.min.js │ │ │ └── pyodide │ │ │ │ ├── packages.json │ │ │ │ ├── pyodide.asm.data │ │ │ │ ├── pyodide.asm.js │ │ │ │ ├── pyodide.asm.wasm │ │ │ │ ├── pyodide.js.map │ │ │ │ └── pyodide_v0.18.1.js │ │ ├── p5_reference.yml │ │ └── styles │ │ │ ├── basscss-7.1.1.min.css │ │ │ └── custom.css │ ├── templates │ │ ├── base.html │ │ ├── index.html │ │ ├── new_sketch_form.html │ │ ├── new_sketch_success.html │ │ └── view_sketch.html │ └── web_app.py ├── monitor.py ├── sketch.py ├── templates │ ├── pyodide │ │ ├── base_sketch.py.template │ │ ├── index.html │ │ └── target_sketch.js.template │ └── transcrypt │ │ ├── base_sketch.py.template │ │ ├── index.html │ │ ├── pyp5js.py │ │ ├── python_functions.py │ │ └── target_sketch.py.template ├── templates_renderers.py └── tests │ ├── __init__.py │ ├── fixtures.py │ ├── test_commands.py │ ├── test_compiler.py │ ├── test_config │ ├── __init__.py │ ├── test_fs.py │ └── test_sketch.py │ ├── test_http │ ├── assets │ │ └── alien.png │ └── test_web_app.py │ ├── test_monitor.py │ ├── test_pyp5js.py │ ├── test_sketch.py │ └── test_templates_renderers.py ├── pytest.ini ├── requirements.txt └── setup.py /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - develop 8 | pull_request: 9 | branches: 10 | - main 11 | - develop 12 | 13 | jobs: 14 | license: 15 | name: Check source files for license headers 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v1 20 | 21 | - name: Check for license headers 22 | run: bash bin/check_license.sh 23 | 24 | test: 25 | name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }} 26 | runs-on: ${{ matrix.os }} 27 | strategy: 28 | max-parallel: 4 29 | matrix: 30 | os: [windows-latest, ubuntu-latest, macos-latest] 31 | python-version: [3.7, 3.8, 3.9, '3.10'] 32 | 33 | steps: 34 | - uses: actions/checkout@v1 35 | 36 | - name: Set up Python ${{ matrix.python-version }} 37 | uses: actions/setup-python@v1 38 | with: 39 | python-version: ${{ matrix.python-version }} 40 | 41 | - name: Display python version 42 | run: python --version 43 | 44 | - name: Upgrade pip 45 | run: python -m pip install --upgrade pip setuptools --user 46 | 47 | - name: Install dev dependencies 48 | run: pip install -r dev-requirements.txt 49 | 50 | - name: Install pyp5js for dev 51 | run: python setup.py develop --install-dir dist 52 | 53 | - name: 54 | run: python -m pytest 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Python 2 | .DS_Store 3 | *.pyc 4 | .vscode 5 | *.env 6 | *.swp 7 | *.swo 8 | *.swn 9 | *.sqlite3 10 | *.map 11 | !pyodide.js.map 12 | __target__ 13 | build 14 | dist 15 | *.egg-info 16 | demo_sketch 17 | tests-sketchbook 18 | venv 19 | docs/examples/dev* 20 | docs/examples/issue* 21 | .theia 22 | .envrc 23 | *.properties.json 24 | .idea/* 25 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: gitpod/workspace-full 2 | 3 | 4 | ports: 5 | - port: 5000 6 | onOpen: open-browser 7 | 8 | 9 | tasks: 10 | - init: 11 | export SKETCHBOOK_DIR=sketchbook && 12 | python -m venv venv --system-site-packages && 13 | venv/bin/pip install -r dev-requirements.txt && 14 | venv/bin/python setup.py develop && 15 | source venv/bin/activate && 16 | pytest 17 | command: pyp5js serve 18 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing to pyp5js 2 | 3 | Here you'll find all possible ways to contribute to the project. 4 | 5 | ### Testing, testing and testing 6 | 7 | Since pyp5js have a lot of moving parts, it would be great to have the p5.js API fully covered and tested. So, use your imagination, code your sketches and, if pyp5js breaks or starts to annoy you with something, you're very welcome to [open an issue](https://github.com/berinhard/pyp5js/issues/new) documenting your thoughts. Test it and let me know how can I improve it. 8 | 9 | ### What about these shinning examples? 10 | 11 | If you fell confortable with that, I'd be happy to add some of your pyp5js sketches to our [examples list](https://berinhard.github.io/pyp5js/examples/)! To do so, you'll have [to fork this repository](https://help.github.com/en/articles/fork-a-repo) and add your new sketch example in the `docs/examples` directory. Once you've your sketch ready, you can [open a pull request](https://help.github.com/en/articles/about-pull-requests) and I'll take a look at it. 12 | 13 | ### I want to hack! 14 | 15 | Okay, if you want to contribute with pyp5js's code, let's go! I really advise you to use [virtualenv with virtualenvwrapper](http://www.indjango.com/python-install-virtualenv-and-virtualenvwrapper/) or [pyenv](https://amaral.northwestern.edu/resources/guides/pyenv-tutorial) to isolate your pyp5js fork from the rest of your system. Once you have everything ready, you can run: 16 | 17 | ``` 18 | $ git clone git@github.com:YOUR_GITHUB_PROFILE/pyp5js.git 19 | $ cd pyp5js 20 | $ pip install -r dev-requirements.txt 21 | $ python setup.py develop 22 | $ make test 23 | ``` 24 | 25 | After that, you should have the `pyp5js` command enabled and it will respect all the changes you introduce to the code. Now, a brief explanation about the code under `pyp5js` directory: 26 | 27 | - `config` module: centralize pieces of code used to configure how `pyp5js` runs 28 | - `cli.py`: the entrypoint for `pyp5js` commands such as `new` or `compile` 29 | - `commands.py`: just functions responsible for the real implementations for `pyp5js` commands 30 | - `compiler.py`: where all the magic happens! 31 | - `exception.py`: custom exceptions used by `pyp5js` 32 | - `monitor.py`: module with the objects used by the `monitor` command 33 | - `sketch.py`: class to abstract Sketches' files, directories and configuration 34 | - `template_renderers.py`: simple module with the renderization logic for the code templates like `target_sketch.py` 35 | - `http/web_app.py`: Flask application for the web interface. 36 | 37 | Now go [fetch yourself an issue](https://github.com/berinhard/pyp5js/issues) and happy hacking! 38 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include pyp5js/templates * 2 | recursive-include pyp5js/http_local/templates * 3 | recursive-include pyp5js/http_local/static * 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | export PYTHONWARNINGS=ignore::flask.DeprecationWarning; pytest 3 | 4 | update_dist: 5 | @python3 setup.py sdist bdist_wheel 6 | 7 | upload_pypi: 8 | @twine upload dist/* 9 | 10 | # helper command for the maintainer to refresh the docs files 11 | refresh_transcrypt_docs: 12 | cd docs/examples/transcrypt; for x in `ls -d */`; do SKETCHBOOK_DIR="/home/bernardo/envs/pyp5js/docs/examples/transcrypt/" pyp5js compile $$x --refresh --template "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/index.html.template"; done; 13 | 14 | refresh_pyodide_docs: 15 | cd docs/examples/pyodide; for x in `ls -d */`; do SKETCHBOOK_DIR="/home/bernardo/envs/pyp5js/docs/examples/pyodide" pyp5js compile $$x --refresh --template "/home/bernardo/envs/pyp5js/docs/examples/pyodide/index.html.template"; done; 16 | 17 | refresh_demo: 18 | SKETCHBOOK_DIR="/home/bernardo/envs/pyp5js/docs/" pyp5js compile pyodide --refresh --template "/home/bernardo/envs/pyp5js/docs/pyodide/index.html.template"; 19 | 20 | run_demo: 21 | cd docs/pyodide && python -m http.server 22 | -------------------------------------------------------------------------------- /Makefile.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | IF /I "%1"=="test" GOTO test 4 | IF /I "%1"=="update_dist" GOTO update_dist 5 | IF /I "%1"=="upload_pypi" GOTO upload_pypi 6 | IF /I "%1"=="run_demo" GOTO run_demo 7 | GOTO error 8 | 9 | :test 10 | set PYTHONWARNINGS=ignore::flask.DeprecationWarning && pytest 11 | GOTO :EOF 12 | 13 | :update_dist 14 | @python3 setup.py sdist bdist_wheel 15 | GOTO :EOF 16 | 17 | :upload_pypi 18 | @twine upload dist/* 19 | GOTO :EOF 20 | 21 | :run_demo 22 | PUSHD docs/pyodide 23 | python -m http.server 24 | POPD 25 | GOTO :EOF 26 | 27 | :error 28 | IF "%1"=="" ( 29 | ECHO make: *** No targets specified and no makefile found. Stop. 30 | ) ELSE ( 31 | ECHO make: *** No rule to make target '%1%'. Stop. 32 | ) 33 | GOTO :EOF 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## pyp5js: drawing with Python 3 2 | 3 | [![PyPI version](https://badge.fury.io/py/pyp5js.svg)](https://badge.fury.io/py/pyp5js) 4 | ![Continuous Integration](https://github.com/berinhard/pyp5js/workflows/Continuous%20Integration/badge.svg?branch=develop&event=push) 5 | [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/berinhard/pyp5js/tree/main) 6 | 7 | > [Processing](https://processing.org) ideas and Python 3 together with [P5.js](https://p5js.org) in the browser. 8 | 9 | Python 3 drawing in the web! Try it [here](https://berinhard.github.io/pyp5js/pyodide/)! 10 | 11 | Here's an example of a valid Python code using P5.js API: 12 | 13 | ```python 14 | def setup(): 15 | createCanvas(200, 200) 16 | 17 | def draw(): 18 | background(200) 19 | diameter = sin(frameCount / 60) * 50 + 50 20 | fill('blue') 21 | ellipse(100, 100, diameter, diameter) 22 | ``` 23 | 24 | ## Project setup 25 | 26 | ``` 27 | $ git clone git@github.com:YOUR_GITHUB_PROFILE/pyp5js.git 28 | $ cd pyp5js 29 | $ pip install -r dev-requirements.txt 30 | $ python setup.py develop 31 | $ make test 32 | ``` 33 | 34 | ## More references 35 | 36 | ### [Documentation](https://berinhard.github.io/pyp5js) 37 | 38 | ### [Examples](https://berinhard.github.io/pyp5js/examples/) 39 | 40 | ### [Installation](https://berinhard.github.io/pyp5js#installation) 41 | 42 | ### [Quickstart](https://berinhard.github.io/pyp5js#quickstart) 43 | 44 | ### [Internals details](https://berinhard.github.io/pyp5js#internals-details) 45 | 46 | ### [Known issues and differences to the Processing.Py and P5.js ways of doing things](https://berinhard.github.io/pyp5js#known-issues-and-differences-to-the-processingpy-and-p5js-ways-of-doing-things) 47 | 48 | ### [How can I contribute?](CONTRIBUTING.md) 49 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.7.3 2 | -------------------------------------------------------------------------------- /bin/check_license.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | EXIT_CODE=0 4 | 5 | while IFS= read -r -d '' file; do 6 | if ! head -5 "$file" | grep -q 'Copyright'; then 7 | echo "$file" is missing a license 8 | EXIT_CODE=1 9 | fi 10 | done < <(find pyp5js -type f \( \ 11 | -name "*.py" -o \ 12 | -name "*.html" -o \ 13 | -name "*.js.template" \) -print0) 14 | 15 | exit $EXIT_CODE 16 | -------------------------------------------------------------------------------- /dev-requirements.txt: -------------------------------------------------------------------------------- 1 | -r requirements.txt 2 | 3 | black==22.10.0 4 | ipython==7.34.0 5 | pytest==7.1.3 6 | tox==3.26.0 7 | pytest-env==0.6.2 8 | Flask-Testing==0.8.1 9 | blinker==1.5 10 | pyaml==21.10.1 11 | wheel==0.38.1 12 | twine==4.0.1 13 | -------------------------------------------------------------------------------- /docs/examples/index.md: -------------------------------------------------------------------------------- 1 | ### Examples list 2 | 3 | Here you find a list of examples using pyp5js. They can have lnks to working examples using Transcrypt or Pyodide as the interpreter. 4 | 5 | **Angles and mouse coordinates** | [pyodide](pyodide/sketch_001/index.html) | [transcrypt](transcrypt/sketch_001/index.html) 6 | 7 | **Move Eye**, an example by Simon Greenwold, ported by [@villares](https://github.com/villares) | [pyodide](pyodide/sketch_002/index.html) | [transcrypt](transcrypt/sketch_002/index.html) 8 | 9 | **Rotating 3D box** | [pyodide](pyodide/sketch_003/index.html) | [transcrypt](transcrypt/sketch_003/index.html) 10 | 11 | **Boids** | [pyodide](pyodide/sketch_004/index.html) | [transcrypt](transcrypt/sketch_004/index.html) 12 | 13 | **Globals variables (HSB and CENTER)** | [pyodide](pyodide/sketch_005/index.html) | [transcrypt](transcrypt/sketch_005/index.html) 14 | 15 | **Registering event functions such as keyPressed** | [pyodide](pyodide/sketch_006/index.html) | [transcrypt](transcrypt/sketch_006/index.html) 16 | 17 | **p5.Vector static methods** | [pyodide](pyodide/sketch_007/index.html) | [transcrypt](transcrypt/sketch_007/index.html) 18 | 19 | **p5.dom.js usage** | [pyodide](pyodide/sketch_008/index.html) | [transcrypt](transcrypt/sketch_008/index.html) 20 | 21 | **Working with images** | [pyodide](pyodide/sketch_009/index.html) | [transcrypt](transcrypt/sketch_009/index.html) 22 | 23 | **Complex shapes**, by [Pedro Queiroga](https://github.com/pedroqueiroga/pqueiroga.github.io/blob/master/curveVertexExample/main.js) | [pyodide](pyodide/sketch_010/index.html) | [transcrypt](transcrypt/sketch_010/index.html) 24 | 25 | **A-star search algoritm**, by [@ademakdogan](https://github.com/ademakdogan) | [pyodide](pyodide/sketch_012/index.html) 26 | 27 | **Breakout**, by [@misolietavec](https://github.com/misolietavec) | [pyodide](pyodide/breakout/index.html) 28 | 29 | **Flappy bird**, by [@misolietavec](https://github.com/misolietavec) | [pyodide](pyodide/flappybird/index.html) 30 | 31 | **Memory**, by [@misolietavec](https://github.com/misolietavec) | [pyodide](pyodide/memory/index.html) 32 | 33 | **Same game**, by [@misolietavec](https://github.com/misolietavec) | [pyodide](pyodide/samegame/index.html) 34 | -------------------------------------------------------------------------------- /docs/examples/pyodide/bouncing/bouncing.py: -------------------------------------------------------------------------------- 1 | x = 50 2 | y = 100 3 | rad = 6 4 | 5 | vx = 5 6 | vy = 5 7 | 8 | WIDTH = 640 9 | HEIGHT = 400 10 | FPS = 60 11 | 12 | def setup(): 13 | createCanvas(WIDTH, HEIGHT) 14 | frameRate(FPS) 15 | 16 | def draw(): 17 | global x, y, vx, vy 18 | 19 | background(220) 20 | fill(0, 255, 0) 21 | ellipse(x, y, 2 * rad) 22 | 23 | x += vx 24 | y += vy 25 | 26 | if (x + rad >= width or x - rad <= 0): 27 | vx = -vx 28 | 29 | if (y + rad >= height or y - rad <= 0): 30 | vy = -vy 31 | -------------------------------------------------------------------------------- /docs/examples/pyodide/bouncing/bouncingFPS.py: -------------------------------------------------------------------------------- 1 | x = 50 2 | y = 100 3 | diam = 10 4 | 5 | vx = 2 6 | vy = 2 7 | framecount = 0 8 | 9 | WIDTH = 640 10 | HEIGHT = 400 11 | FPS = 60 12 | afps = FPS 13 | 14 | def setup(): 15 | createCanvas(WIDTH, HEIGHT) 16 | frameRate(FPS) 17 | 18 | def draw(): 19 | global x, y, vx, vy, framecount, afps 20 | 21 | background(220) 22 | fill(255, 0, 0) 23 | ellipse(x, y, diam) 24 | framecount += 1 25 | if not framecount % FPS: 26 | afps = frameRate() 27 | fill(10) 28 | textSize(20) 29 | text("FPS: %.1f" %afps, 30, HEIGHT - 24) 30 | x += vx 31 | y += vy 32 | 33 | if (x + diam // 2 >= width or x - diam // 2 <= 0): 34 | vx = -vx 35 | 36 | if (y + diam // 2 >= height or y - diam // 2 <= 0): 37 | vy = -vy 38 | 39 | -------------------------------------------------------------------------------- /docs/examples/pyodide/bouncing/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | bouncing - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 | 38 | 39 |

40 | Python code here. 41 |

42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 |
x = 50
50 | y = 100
51 | rad = 6
52 | 
53 | vx = 5
54 | vy = 5
55 | 
56 | WIDTH = 640
57 | HEIGHT = 400
58 | FPS = 60
59 | 
60 | def setup():
61 |     createCanvas(WIDTH, HEIGHT)
62 |     frameRate(FPS)
63 | 
64 | def draw():
65 |     global x, y, vx, vy
66 |     
67 |     background(220)
68 |     fill(0, 255, 0)
69 |     ellipse(x, y, 2 * rad)
70 | 
71 |     x += vx
72 |     y += vy
73 |   
74 |     if (x + rad >= width or x - rad <= 0):
75 |         vx = -vx
76 |     
77 |     if (y + rad >= height or y - rad <= 0):
78 |         vy = -vy
79 | 
80 |
81 | 82 |
83 | 84 | -------------------------------------------------------------------------------- /docs/examples/pyodide/bouncing/odkaz.txt: -------------------------------------------------------------------------------- 1 | https://github.com/Luxapodular/Py5.js/blob/master/examples/bouncingBall.py 2 | -------------------------------------------------------------------------------- /docs/examples/pyodide/flappybird/images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/flappybird/images/background.png -------------------------------------------------------------------------------- /docs/examples/pyodide/flappybird/images/bird1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/flappybird/images/bird1.png -------------------------------------------------------------------------------- /docs/examples/pyodide/flappybird/images/bird2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/flappybird/images/bird2.png -------------------------------------------------------------------------------- /docs/examples/pyodide/flappybird/images/birddead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/flappybird/images/birddead.png -------------------------------------------------------------------------------- /docs/examples/pyodide/flappybird/images/bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/flappybird/images/bottom.png -------------------------------------------------------------------------------- /docs/examples/pyodide/flappybird/images/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/flappybird/images/top.png -------------------------------------------------------------------------------- /docs/examples/pyodide/index.html.template: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{ sketch_name }} - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 | 38 | 39 |

40 | Python code here. 41 |

42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 |
{{ sketch_content }}
50 |
51 | 52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/LICENCE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Steve Holden 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/card_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/card_back.png -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/checkmark-old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/checkmark-old.png -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/checkmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/checkmark.png -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/im1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/im1.png -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/im2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/im2.png -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/im3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/im3.png -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/im4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/im4.png -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/im5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/im5.png -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/im6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/im6.png -------------------------------------------------------------------------------- /docs/examples/pyodide/memory/images/steve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/memory/images/steve.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images: -------------------------------------------------------------------------------- 1 | images60 -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/blank.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/cover.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/eight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/eight.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/five.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/five.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/flag.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/four.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/mine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/mine.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/one.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/red.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/seven.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/seven.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/six.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/six.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/three.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images30/two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images30/two.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/blank.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/cover.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/eight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/eight.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/five.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/five.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/flag.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/four.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/mine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/mine.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/one.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/red.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/seven.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/seven.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/six.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/six.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/three.png -------------------------------------------------------------------------------- /docs/examples/pyodide/mines/images60/two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/mines/images60/two.png -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_001/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_001 - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 | 38 | 39 |

40 | Python code here. 41 |

42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 |
# https://p5js.org/examples/interaction-wavemaker.html
50 | 
51 | t = 0
52 | 
53 | def setup():
54 |     createCanvas(600, 600)
55 |     stroke(250)
56 |     strokeWeight(3)
57 |     fill(40, 200, 40)
58 | 
59 | 
60 | def draw():
61 |     global t
62 |     background(10, 10)
63 | 
64 |     xAngle = map(mouseX, 0, width, -4 * PI, 4 * PI, True)
65 |     yAngle = map(mouseY, 0, height, -4 * PI, 4 * PI, True)
66 |     for x in range(0, width, 30):
67 |         for y in range(0, height, 30):
68 | 
69 |             angle = xAngle * (x / width) + yAngle * (y / height)
70 | 
71 |             myX = x + 20 * cos(2 * PI * t + angle)
72 |             myY = y + 20 * sin(2 * TWO_PI * t + angle)
73 | 
74 |             ellipse(myX, myY, 10)
75 | 
76 |     t = t + 0.01
77 | 
78 |
79 | 80 |
81 | 82 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_001/sketch_001.py: -------------------------------------------------------------------------------- 1 | # https://p5js.org/examples/interaction-wavemaker.html 2 | 3 | t = 0 4 | 5 | def setup(): 6 | createCanvas(600, 600) 7 | stroke(250) 8 | strokeWeight(3) 9 | fill(40, 200, 40) 10 | 11 | 12 | def draw(): 13 | global t 14 | background(10, 10) 15 | 16 | xAngle = map(mouseX, 0, width, -4 * PI, 4 * PI, True) 17 | yAngle = map(mouseY, 0, height, -4 * PI, 4 * PI, True) 18 | for x in range(0, width, 30): 19 | for y in range(0, height, 30): 20 | 21 | angle = xAngle * (x / width) + yAngle * (y / height) 22 | 23 | myX = x + 20 * cos(2 * PI * t + angle) 24 | myY = y + 20 * sin(2 * TWO_PI * t + angle) 25 | 26 | ellipse(myX, myY, 10) 27 | 28 | t = t + 0.01 29 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_002/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_002 - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 | 38 | 39 |

40 | Python code here. 41 |

42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 |
"""
50 |  * Move Eye.
51 |  * by Simon Greenwold.
52 |  *
53 |  * The camera lifts up (controlled by mouseY) while looking at the same point.
54 |  """
55 | 
56 | def setup():
57 |     createCanvas(640, 360, WEBGL)
58 |     fill(204)
59 | 
60 | 
61 | def draw():
62 |     ambientLight(50)
63 |     directionalLight(255, 0, 0, 0.25, 0.25, 0);
64 |     background(0)
65 | 
66 |     # Change height of the camera with mouseY
67 |     camera(30.0, mouseY, 220.0,  # eyeX, eyeY, eyeZ
68 |            0.0, 0.0, 0.0,        # centerX, centerY, centerZ
69 |            0.0, 1.0, 0.0)        # upX, upY, upZ
70 | 
71 |     noStroke()
72 |     box(90)
73 |     stroke(255)
74 |     line(-100, 0, 0, 100, 0, 0)
75 |     line(0, -100, 0, 0, 100, 0)
76 |     line(0, 0, -100, 0, 0, 100)
77 | 
78 |
79 | 80 |
81 | 82 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_002/sketch_002.py: -------------------------------------------------------------------------------- 1 | """ 2 | * Move Eye. 3 | * by Simon Greenwold. 4 | * 5 | * The camera lifts up (controlled by mouseY) while looking at the same point. 6 | """ 7 | 8 | def setup(): 9 | createCanvas(640, 360, WEBGL) 10 | fill(204) 11 | 12 | 13 | def draw(): 14 | ambientLight(50) 15 | directionalLight(255, 0, 0, 0.25, 0.25, 0); 16 | background(0) 17 | 18 | # Change height of the camera with mouseY 19 | camera(30.0, mouseY, 220.0, # eyeX, eyeY, eyeZ 20 | 0.0, 0.0, 0.0, # centerX, centerY, centerZ 21 | 0.0, 1.0, 0.0) # upX, upY, upZ 22 | 23 | noStroke() 24 | box(90) 25 | stroke(255) 26 | line(-100, 0, 0, 100, 0, 0) 27 | line(0, -100, 0, 0, 100, 0) 28 | line(0, 0, -100, 0, 0, 100) 29 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_003/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_003 - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 | 38 | 39 |

40 | Python code here. 41 |

42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 |
# 3d example
50 | 
51 | def setup():
52 |     createCanvas(600, 600, WEBGL)
53 | 
54 | def draw():
55 |     background(200)
56 |     translate(-100, -100, 0)
57 |     push()
58 |     normalMaterial()
59 |     rotateZ(frameCount * 0.01)
60 |     rotateX(frameCount * 0.01)
61 |     rotateY(frameCount * 0.01)
62 |     box(50, 70, 100)
63 |     pop()
64 | 
65 |
66 | 67 |
68 | 69 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_003/sketch_003.py: -------------------------------------------------------------------------------- 1 | # 3d example 2 | 3 | def setup(): 4 | createCanvas(600, 600, WEBGL) 5 | 6 | def draw(): 7 | background(200) 8 | translate(-100, -100, 0) 9 | push() 10 | normalMaterial() 11 | rotateZ(frameCount * 0.01) 12 | rotateX(frameCount * 0.01) 13 | rotateY(frameCount * 0.01) 14 | box(50, 70, 100) 15 | pop() 16 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_005/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_005 - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 | 38 | 39 |

40 | Python code here. 41 |

42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 |

50 | def setup():
51 |     createCanvas(600,600)
52 |     noStroke()
53 |     rectMode(CENTER)
54 | 
55 | 
56 | def draw():
57 |     colorMode(HSB,100)
58 |     h = map(mouseY,0,600,0,100)
59 |     background(h,100,100)
60 |     fill(100-h,100,100)
61 |     rect(300,300,mouseX+1,mouseX+1)
62 | 
63 |
64 | 65 |
66 | 67 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_005/sketch_005.py: -------------------------------------------------------------------------------- 1 | 2 | def setup(): 3 | createCanvas(600,600) 4 | noStroke() 5 | rectMode(CENTER) 6 | 7 | 8 | def draw(): 9 | colorMode(HSB,100) 10 | h = map(mouseY,0,600,0,100) 11 | background(h,100,100) 12 | fill(100-h,100,100) 13 | rect(300,300,mouseX+1,mouseX+1) 14 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_006/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_006 - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 | 38 | 39 |

40 | Python code here. 41 |

42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 |
r = None
50 | 
51 | def setup():
52 |     global r
53 | 
54 |     createCanvas(900, 900)
55 |     r = random(100, 700)
56 |     noFill()
57 | 
58 | def draw():
59 |     x, y = 100, 100
60 |     rect(x, y, r, r)
61 | 
62 | def keyPressed():
63 |     console.log("Key pressed event")
64 | 
65 |     if key == "n":
66 |         global r
67 |         r = random(100, 700)
68 |         redraw()
69 | 
70 | def mouseDragged():
71 |     global r
72 |     r = random(100, 700)
73 |     redraw()
74 | 
75 |
76 | 77 |
78 | 79 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_006/sketch_006.py: -------------------------------------------------------------------------------- 1 | r = None 2 | 3 | def setup(): 4 | global r 5 | 6 | createCanvas(900, 900) 7 | r = random(100, 700) 8 | noFill() 9 | 10 | def draw(): 11 | x, y = 100, 100 12 | rect(x, y, r, r) 13 | 14 | def keyPressed(): 15 | console.log("Key pressed event") 16 | 17 | if key == "n": 18 | global r 19 | r = random(100, 700) 20 | redraw() 21 | 22 | def mouseDragged(): 23 | global r 24 | r = random(100, 700) 25 | redraw() 26 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_007/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_007 - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 | 38 | 39 |

40 | Python code here. 41 |

42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 |

50 | def setup():
51 |     createCanvas(900, 900)
52 |     stroke(27, 27, 27, 10)
53 |     strokeWeight(2)
54 | 
55 | 
56 | def draw():
57 |     push()
58 | 
59 |     translate(width / 2, height / 2)
60 |     v = PVector.random2D()
61 |     v.normalize()
62 |     v = PVector.mult(v,random(100, 400))
63 |     line(0, 0, v.x, v.y)
64 | 
65 |     pop()
66 | 
67 |
68 | 69 |
70 | 71 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_007/sketch_007.py: -------------------------------------------------------------------------------- 1 | 2 | def setup(): 3 | createCanvas(900, 900) 4 | stroke(27, 27, 27, 10) 5 | strokeWeight(2) 6 | 7 | 8 | def draw(): 9 | push() 10 | 11 | translate(width / 2, height / 2) 12 | v = PVector.random2D() 13 | v.normalize() 14 | v = PVector.mult(v,random(100, 400)) 15 | line(0, 0, v.x, v.y) 16 | 17 | pop() 18 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_008/sketch_008.py: -------------------------------------------------------------------------------- 1 | rect_base_size = 30 2 | positions = [] 3 | rect_size = None 4 | 5 | def setup(): 6 | global rect_size 7 | 8 | createP("Hi! This is an example of how to use p5.dom.js with pyp5js") 9 | 10 | # creates a container div 11 | slider_div = createDiv() 12 | slider_div.style("display", "block") 13 | 14 | # creates the slider 15 | rect_size = createSlider(0, 600, 100) 16 | rect_size.style('width', '50%') 17 | 18 | # adds the slider to the container div 19 | slider_div.child(rect_size) 20 | 21 | createCanvas(600, 600) 22 | 23 | for x in range(-rect_base_size, width + rect_base_size, rect_base_size): 24 | for y in range(-rect_base_size, height + rect_base_size, rect_base_size): 25 | positions.append((x, y)) 26 | 27 | noFill() 28 | strokeWeight(2) 29 | rectMode(CENTER) 30 | 31 | 32 | def draw(): 33 | background(255) 34 | size = rect_size.value() 35 | for x, y in positions: 36 | rect(x, y, size, size) 37 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_009/alien.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/sketch_009/alien.png -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_009/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_009 - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 | 38 | 39 |

40 | Python code here. 41 |

42 | 43 |
44 |
45 | 46 |
47 | 48 |
49 |
from random import choice
50 | 
51 | images = []
52 | 
53 | def setup():
54 |     global images
55 | 
56 |     createP("Click to add a new image")
57 |     createCanvas(600, 600)
58 |     background(200)
59 |     images = [
60 |         loadImage('smile.png'),
61 |         loadImage('alien.png'),
62 |         loadImage('rainbow.png'),
63 |     ]
64 | 
65 | 
66 | def mousePressed():
67 |     x, y = mouseX, mouseY
68 |     img = choice(images)
69 |     image(img, x, y)
70 | 
71 | 
72 | def draw():
73 |     pass
74 | 
75 |
76 | 77 |
78 | 79 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_009/rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/sketch_009/rainbow.png -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_009/sketch_009.py: -------------------------------------------------------------------------------- 1 | from random import choice 2 | 3 | images = [] 4 | 5 | def setup(): 6 | global images 7 | 8 | createP("Click to add a new image") 9 | createCanvas(600, 600) 10 | background(200) 11 | images = [ 12 | loadImage('smile.png'), 13 | loadImage('alien.png'), 14 | loadImage('rainbow.png'), 15 | ] 16 | 17 | 18 | def mousePressed(): 19 | x, y = mouseX, mouseY 20 | img = choice(images) 21 | image(img, x, y) 22 | 23 | 24 | def draw(): 25 | pass 26 | -------------------------------------------------------------------------------- /docs/examples/pyodide/sketch_009/smile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/pyodide/sketch_009/smile.png -------------------------------------------------------------------------------- /docs/examples/sketch_000/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_000 - pyp5js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 |
20 | 21 | -------------------------------------------------------------------------------- /docs/examples/sketch_000/sketch_000.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | 4 | def setup(): 5 | createCanvas(200, 200) 6 | 7 | def draw(): 8 | background(200) 9 | diameter = sin(frameCount / 60) * 50 + 50 10 | fill("blue") 11 | ellipse(100, 100, diameter, diameter) 12 | -------------------------------------------------------------------------------- /docs/examples/sketch_000/target/pyp5js.python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2020-04-28 21:56:46 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'pyp5js.python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=pyp5js.python_functions.map -------------------------------------------------------------------------------- /docs/examples/sketch_000/target/pyp5js.python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/sketch_000/target/sketch_000.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | 4 | def setup(): 5 | createCanvas(200, 200) 6 | background(160) 7 | 8 | 9 | def draw(): 10 | fill("blue") 11 | background(200) 12 | radius = sin(frameCount / 60) * 50 + 50 13 | ellipse(100, 100, radius, radius) 14 | -------------------------------------------------------------------------------- /docs/examples/sketch_000/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/sketch_000/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.virtualenvs/pyp5js/lib/python3.6/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/sketch_000/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/sketch_000/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/sketch_000/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/sketch_000/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/sketch_000/__target__/pyp5js.python_functions.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/sketch_000/sketch_000.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/sketch_000/__target__/sketch_000.js"}]} -------------------------------------------------------------------------------- /docs/examples/sketch_000/target/target_sketch.py: -------------------------------------------------------------------------------- 1 | import sketch_000 as source_sketch 2 | from pyp5js import * 3 | 4 | event_functions = { 5 | "deviceMoved": source_sketch.deviceMoved, 6 | "deviceTurned": source_sketch.deviceTurned, 7 | "deviceShaken": source_sketch.deviceShaken, 8 | "keyPressed": source_sketch.keyPressed, 9 | "keyReleased": source_sketch.keyReleased, 10 | "keyTyped": source_sketch.keyTyped, 11 | "mouseMoved": source_sketch.mouseMoved, 12 | "mouseDragged": source_sketch.mouseDragged, 13 | "mousePressed": source_sketch.mousePressed, 14 | "mouseReleased": source_sketch.mouseReleased, 15 | "mouseClicked": source_sketch.mouseClicked, 16 | "doubleClicked": source_sketch.doubleClicked, 17 | "mouseWheel": source_sketch.mouseWheel, 18 | "touchStarted": source_sketch.touchStarted, 19 | "touchMoved": source_sketch.touchMoved, 20 | "touchEnded": source_sketch.touchEnded, 21 | "windowResized": source_sketch.windowResized, 22 | } 23 | 24 | start_p5(source_sketch.setup, source_sketch.draw, event_functions) -------------------------------------------------------------------------------- /docs/examples/transcrypt/index.html.template: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{ sketch_name }} - pyp5js (using Transcrypt) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 35 | 36 | 37 | 38 |

39 | Python code here. 40 |

41 | 42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |              
50 | {{ sketch_content }}
51 |               
52 |           
53 |
54 | 55 |
56 | 57 | 58 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_001/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_001 - pyp5js (using Transcrypt) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 35 | 36 | 37 | 38 |

39 | Python code here. 40 |

41 | 42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |              
50 | # https://p5js.org/examples/interaction-wavemaker.html
51 | 
52 | t = 0
53 | 
54 | def setup():
55 |     createCanvas(600, 600)
56 |     stroke(250)
57 |     strokeWeight(3)
58 |     fill(40, 200, 40)
59 | 
60 | 
61 | def draw():
62 |     global t
63 |     background(10, 10)
64 | 
65 |     xAngle = map(mouseX, 0, width, -4 * PI, 4 * PI, True)
66 |     yAngle = map(mouseY, 0, height, -4 * PI, 4 * PI, True)
67 |     for x in range(0, width, 30):
68 |         for y in range(0, height, 30):
69 | 
70 |             angle = xAngle * (x / width) + yAngle * (y / height)
71 | 
72 |             myX = x + 20 * cos(2 * PI * t + angle)
73 |             myY = y + 20 * sin(2 * TWO_PI * t + angle)
74 | 
75 |             ellipse(myX, myY, 10)
76 | 
77 |     t = t + 0.01
78 | 
79 |               
80 |           
81 |
82 | 83 |
84 | 85 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_001/sketch_001.py: -------------------------------------------------------------------------------- 1 | # https://p5js.org/examples/interaction-wavemaker.html 2 | 3 | t = 0 4 | 5 | def setup(): 6 | createCanvas(600, 600) 7 | stroke(250) 8 | strokeWeight(3) 9 | fill(40, 200, 40) 10 | 11 | 12 | def draw(): 13 | global t 14 | background(10, 10) 15 | 16 | xAngle = map(mouseX, 0, width, -4 * PI, 4 * PI, True) 17 | yAngle = map(mouseY, 0, height, -4 * PI, 4 * PI, True) 18 | for x in range(0, width, 30): 19 | for y in range(0, height, 30): 20 | 21 | angle = xAngle * (x / width) + yAngle * (y / height) 22 | 23 | myX = x + 20 * cos(2 * PI * t + angle) 24 | myY = y + 20 * sin(2 * TWO_PI * t + angle) 25 | 26 | ellipse(myX, myY, 10) 27 | 28 | t = t + 0.01 29 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_001/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:09 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_001/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_001/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_001/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_001/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_001/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_001/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_001/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_001/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_001/target/target_sketch.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | def preload(): 4 | pass 5 | 6 | def setup(): 7 | pass 8 | 9 | def draw(): 10 | pass 11 | 12 | deviceMoved = None 13 | deviceTurned = None 14 | deviceShaken = None 15 | keyPressed = None 16 | keyReleased = None 17 | keyTyped = None 18 | mouseMoved = None 19 | mouseDragged = None 20 | mousePressed = None 21 | mouseReleased = None 22 | mouseClicked = None 23 | doubleClicked = None 24 | mouseWheel = None 25 | touchStarted = None 26 | touchMoved = None 27 | touchEnded = None 28 | windowResized = None 29 | keyIsDown = None 30 | 31 | 32 | # https://p5js.org/examples/interaction-wavemaker.html 33 | 34 | t = 0 35 | 36 | def setup(): 37 | createCanvas(600, 600) 38 | stroke(250) 39 | strokeWeight(3) 40 | fill(40, 200, 40) 41 | 42 | 43 | def draw(): 44 | global t 45 | background(10, 10) 46 | 47 | xAngle = map(mouseX, 0, width, -4 * PI, 4 * PI, True) 48 | yAngle = map(mouseY, 0, height, -4 * PI, 4 * PI, True) 49 | for x in range(0, width, 30): 50 | for y in range(0, height, 30): 51 | 52 | angle = xAngle * (x / width) + yAngle * (y / height) 53 | 54 | myX = x + 20 * cos(2 * PI * t + angle) 55 | myY = y + 20 * sin(2 * TWO_PI * t + angle) 56 | 57 | ellipse(myX, myY, 10) 58 | 59 | t = t + 0.01 60 | 61 | 62 | 63 | event_functions = { 64 | "deviceMoved": deviceMoved, 65 | "deviceTurned": deviceTurned, 66 | "deviceShaken": deviceShaken, 67 | "keyPressed": keyPressed, 68 | "keyReleased": keyReleased, 69 | "keyTyped": keyTyped, 70 | "mouseMoved": mouseMoved, 71 | "mouseDragged": mouseDragged, 72 | "mousePressed": mousePressed, 73 | "mouseReleased": mouseReleased, 74 | "mouseClicked": mouseClicked, 75 | "doubleClicked": doubleClicked, 76 | "mouseWheel": mouseWheel, 77 | "touchStarted": touchStarted, 78 | "touchMoved": touchMoved, 79 | "touchEnded": touchEnded, 80 | "windowResized": windowResized, 81 | "keyIsDown": keyIsDown, 82 | } 83 | 84 | start_p5(preload, setup, draw, event_functions) -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_002/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_002 - pyp5js (using Transcrypt) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 35 | 36 | 37 | 38 |

39 | Python code here. 40 |

41 | 42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |              
50 | """
51 |  * Move Eye.
52 |  * by Simon Greenwold.
53 |  *
54 |  * The camera lifts up (controlled by mouseY) while looking at the same point.
55 |  """
56 | 
57 | def setup():
58 |     createCanvas(640, 360, _P5_INSTANCE.WEBGL)
59 |     fill(204)
60 | 
61 | 
62 | def draw():
63 |     ambientLight(50)
64 |     directionalLight(255, 0, 0, 0.25, 0.25, 0);
65 |     background(0)
66 | 
67 |     # Change height of the camera with mouseY
68 |     camera(30.0, mouseY, 220.0,  # eyeX, eyeY, eyeZ
69 |            0.0, 0.0, 0.0,        # centerX, centerY, centerZ
70 |            0.0, 1.0, 0.0)        # upX, upY, upZ
71 | 
72 |     noStroke()
73 |     box(90)
74 |     stroke(255)
75 |     line(-100, 0, 0, 100, 0, 0)
76 |     line(0, -100, 0, 0, 100, 0)
77 |     line(0, 0, -100, 0, 0, 100)
78 | 
79 |               
80 |           
81 |
82 | 83 |
84 | 85 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_002/sketch_002.py: -------------------------------------------------------------------------------- 1 | """ 2 | * Move Eye. 3 | * by Simon Greenwold. 4 | * 5 | * The camera lifts up (controlled by mouseY) while looking at the same point. 6 | """ 7 | 8 | def setup(): 9 | createCanvas(640, 360, _P5_INSTANCE.WEBGL) 10 | fill(204) 11 | 12 | 13 | def draw(): 14 | ambientLight(50) 15 | directionalLight(255, 0, 0, 0.25, 0.25, 0); 16 | background(0) 17 | 18 | # Change height of the camera with mouseY 19 | camera(30.0, mouseY, 220.0, # eyeX, eyeY, eyeZ 20 | 0.0, 0.0, 0.0, # centerX, centerY, centerZ 21 | 0.0, 1.0, 0.0) # upX, upY, upZ 22 | 23 | noStroke() 24 | box(90) 25 | stroke(255) 26 | line(-100, 0, 0, 100, 0, 0) 27 | line(0, -100, 0, 0, 100, 0) 28 | line(0, 0, -100, 0, 0, 100) 29 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_002/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:10 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_002/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_002/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_002/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_002/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_002/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_002/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_002/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_002/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_002/target/target_sketch.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | def preload(): 4 | pass 5 | 6 | def setup(): 7 | pass 8 | 9 | def draw(): 10 | pass 11 | 12 | deviceMoved = None 13 | deviceTurned = None 14 | deviceShaken = None 15 | keyPressed = None 16 | keyReleased = None 17 | keyTyped = None 18 | mouseMoved = None 19 | mouseDragged = None 20 | mousePressed = None 21 | mouseReleased = None 22 | mouseClicked = None 23 | doubleClicked = None 24 | mouseWheel = None 25 | touchStarted = None 26 | touchMoved = None 27 | touchEnded = None 28 | windowResized = None 29 | keyIsDown = None 30 | 31 | 32 | """ 33 | * Move Eye. 34 | * by Simon Greenwold. 35 | * 36 | * The camera lifts up (controlled by mouseY) while looking at the same point. 37 | """ 38 | 39 | def setup(): 40 | createCanvas(640, 360, _P5_INSTANCE.WEBGL) 41 | fill(204) 42 | 43 | 44 | def draw(): 45 | ambientLight(50) 46 | directionalLight(255, 0, 0, 0.25, 0.25, 0); 47 | background(0) 48 | 49 | # Change height of the camera with mouseY 50 | camera(30.0, mouseY, 220.0, # eyeX, eyeY, eyeZ 51 | 0.0, 0.0, 0.0, # centerX, centerY, centerZ 52 | 0.0, 1.0, 0.0) # upX, upY, upZ 53 | 54 | noStroke() 55 | box(90) 56 | stroke(255) 57 | line(-100, 0, 0, 100, 0, 0) 58 | line(0, -100, 0, 0, 100, 0) 59 | line(0, 0, -100, 0, 0, 100) 60 | 61 | 62 | 63 | event_functions = { 64 | "deviceMoved": deviceMoved, 65 | "deviceTurned": deviceTurned, 66 | "deviceShaken": deviceShaken, 67 | "keyPressed": keyPressed, 68 | "keyReleased": keyReleased, 69 | "keyTyped": keyTyped, 70 | "mouseMoved": mouseMoved, 71 | "mouseDragged": mouseDragged, 72 | "mousePressed": mousePressed, 73 | "mouseReleased": mouseReleased, 74 | "mouseClicked": mouseClicked, 75 | "doubleClicked": doubleClicked, 76 | "mouseWheel": mouseWheel, 77 | "touchStarted": touchStarted, 78 | "touchMoved": touchMoved, 79 | "touchEnded": touchEnded, 80 | "windowResized": windowResized, 81 | "keyIsDown": keyIsDown, 82 | } 83 | 84 | start_p5(preload, setup, draw, event_functions) -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_003/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_003 - pyp5js (using Transcrypt) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 35 | 36 | 37 | 38 |

39 | Python code here. 40 |

41 | 42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |              
50 | # 3d example
51 | 
52 | 
53 | def setup():
54 |     createCanvas(600, 600, WEBGL)
55 | 
56 | def draw():
57 |     background(200)
58 |     translate(-100, -100, 0)
59 |     push()
60 |     normalMaterial()
61 |     rotateZ(frameCount * 0.01)
62 |     rotateX(frameCount * 0.01)
63 |     rotateY(frameCount * 0.01)
64 |     box(50, 70, 100)
65 |     pop()
66 | 
67 |               
68 |           
69 |
70 | 71 |
72 | 73 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_003/sketch_003.py: -------------------------------------------------------------------------------- 1 | # 3d example 2 | 3 | 4 | def setup(): 5 | createCanvas(600, 600, WEBGL) 6 | 7 | def draw(): 8 | background(200) 9 | translate(-100, -100, 0) 10 | push() 11 | normalMaterial() 12 | rotateZ(frameCount * 0.01) 13 | rotateX(frameCount * 0.01) 14 | rotateY(frameCount * 0.01) 15 | box(50, 70, 100) 16 | pop() 17 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_003/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:11 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_003/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_003/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_003/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_003/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_003/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_003/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_003/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_003/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_003/target/target_sketch.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | def preload(): 4 | pass 5 | 6 | def setup(): 7 | pass 8 | 9 | def draw(): 10 | pass 11 | 12 | deviceMoved = None 13 | deviceTurned = None 14 | deviceShaken = None 15 | keyPressed = None 16 | keyReleased = None 17 | keyTyped = None 18 | mouseMoved = None 19 | mouseDragged = None 20 | mousePressed = None 21 | mouseReleased = None 22 | mouseClicked = None 23 | doubleClicked = None 24 | mouseWheel = None 25 | touchStarted = None 26 | touchMoved = None 27 | touchEnded = None 28 | windowResized = None 29 | keyIsDown = None 30 | 31 | 32 | # 3d example 33 | 34 | 35 | def setup(): 36 | createCanvas(600, 600, WEBGL) 37 | 38 | def draw(): 39 | background(200) 40 | translate(-100, -100, 0) 41 | push() 42 | normalMaterial() 43 | rotateZ(frameCount * 0.01) 44 | rotateX(frameCount * 0.01) 45 | rotateY(frameCount * 0.01) 46 | box(50, 70, 100) 47 | pop() 48 | 49 | 50 | 51 | event_functions = { 52 | "deviceMoved": deviceMoved, 53 | "deviceTurned": deviceTurned, 54 | "deviceShaken": deviceShaken, 55 | "keyPressed": keyPressed, 56 | "keyReleased": keyReleased, 57 | "keyTyped": keyTyped, 58 | "mouseMoved": mouseMoved, 59 | "mouseDragged": mouseDragged, 60 | "mousePressed": mousePressed, 61 | "mouseReleased": mouseReleased, 62 | "mouseClicked": mouseClicked, 63 | "doubleClicked": doubleClicked, 64 | "mouseWheel": mouseWheel, 65 | "touchStarted": touchStarted, 66 | "touchMoved": touchMoved, 67 | "touchEnded": touchEnded, 68 | "windowResized": windowResized, 69 | "keyIsDown": keyIsDown, 70 | } 71 | 72 | start_p5(preload, setup, draw, event_functions) -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_004/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:12 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_004/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_004/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_004/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_004/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_004/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_004/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_004/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_004/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_005/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_005 - pyp5js (using Transcrypt) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 35 | 36 | 37 | 38 |

39 | Python code here. 40 |

41 | 42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |              
50 | def setup():
51 |     createCanvas(600,600)
52 |     noStroke()
53 |     rectMode(CENTER)
54 | 
55 | 
56 | def draw():
57 |     colorMode(HSB,100)
58 |     h = map(mouseY,0,600,0,100)
59 |     background(h,100,100)
60 |     fill(100-h,100,100)
61 |     rect(300,300,mouseX+1,mouseX+1)
62 | 
63 |               
64 |           
65 |
66 | 67 |
68 | 69 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_005/sketch_005.py: -------------------------------------------------------------------------------- 1 | def setup(): 2 | createCanvas(600,600) 3 | noStroke() 4 | rectMode(CENTER) 5 | 6 | 7 | def draw(): 8 | colorMode(HSB,100) 9 | h = map(mouseY,0,600,0,100) 10 | background(h,100,100) 11 | fill(100-h,100,100) 12 | rect(300,300,mouseX+1,mouseX+1) 13 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_005/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:13 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_005/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_005/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_005/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_005/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_005/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_005/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_005/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_005/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_005/target/target_sketch.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | def preload(): 4 | pass 5 | 6 | def setup(): 7 | pass 8 | 9 | def draw(): 10 | pass 11 | 12 | deviceMoved = None 13 | deviceTurned = None 14 | deviceShaken = None 15 | keyPressed = None 16 | keyReleased = None 17 | keyTyped = None 18 | mouseMoved = None 19 | mouseDragged = None 20 | mousePressed = None 21 | mouseReleased = None 22 | mouseClicked = None 23 | doubleClicked = None 24 | mouseWheel = None 25 | touchStarted = None 26 | touchMoved = None 27 | touchEnded = None 28 | windowResized = None 29 | keyIsDown = None 30 | 31 | 32 | def setup(): 33 | createCanvas(600,600) 34 | noStroke() 35 | rectMode(CENTER) 36 | 37 | 38 | def draw(): 39 | colorMode(HSB,100) 40 | h = map(mouseY,0,600,0,100) 41 | background(h,100,100) 42 | fill(100-h,100,100) 43 | rect(300,300,mouseX+1,mouseX+1) 44 | 45 | 46 | 47 | event_functions = { 48 | "deviceMoved": deviceMoved, 49 | "deviceTurned": deviceTurned, 50 | "deviceShaken": deviceShaken, 51 | "keyPressed": keyPressed, 52 | "keyReleased": keyReleased, 53 | "keyTyped": keyTyped, 54 | "mouseMoved": mouseMoved, 55 | "mouseDragged": mouseDragged, 56 | "mousePressed": mousePressed, 57 | "mouseReleased": mouseReleased, 58 | "mouseClicked": mouseClicked, 59 | "doubleClicked": doubleClicked, 60 | "mouseWheel": mouseWheel, 61 | "touchStarted": touchStarted, 62 | "touchMoved": touchMoved, 63 | "touchEnded": touchEnded, 64 | "windowResized": windowResized, 65 | "keyIsDown": keyIsDown, 66 | } 67 | 68 | start_p5(preload, setup, draw, event_functions) -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_006/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_006 - pyp5js (using Transcrypt) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 35 | 36 | 37 | 38 |

39 | Python code here. 40 |

41 | 42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |              
50 | r = None
51 | def setup():
52 |     global r
53 | 
54 |     createCanvas(900, 900)
55 |     r = random(100, 700)
56 |     noFill()
57 | 
58 | 
59 | def draw():
60 |     x, y = 100, 100
61 |     rect(x, y, r, r)
62 | 
63 | 
64 | def keyPressed():
65 |     console.log("Key pressed event")
66 | 
67 |     if key == "n":
68 |         global r
69 |         r = random(100, 700)
70 |         redraw()
71 | 
72 | 
73 | def mouseDragged():
74 |     global r
75 |     r = random(100, 700)
76 |     redraw()
77 | 
78 |               
79 |           
80 |
81 | 82 |
83 | 84 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_006/sketch_006.py: -------------------------------------------------------------------------------- 1 | r = None 2 | def setup(): 3 | global r 4 | 5 | createCanvas(900, 900) 6 | r = random(100, 700) 7 | noFill() 8 | 9 | 10 | def draw(): 11 | x, y = 100, 100 12 | rect(x, y, r, r) 13 | 14 | 15 | def keyPressed(): 16 | console.log("Key pressed event") 17 | 18 | if key == "n": 19 | global r 20 | r = random(100, 700) 21 | redraw() 22 | 23 | 24 | def mouseDragged(): 25 | global r 26 | r = random(100, 700) 27 | redraw() 28 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_006/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:14 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_006/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_006/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_006/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_006/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_006/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_006/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_006/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_006/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_006/target/target_sketch.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | def preload(): 4 | pass 5 | 6 | def setup(): 7 | pass 8 | 9 | def draw(): 10 | pass 11 | 12 | deviceMoved = None 13 | deviceTurned = None 14 | deviceShaken = None 15 | keyPressed = None 16 | keyReleased = None 17 | keyTyped = None 18 | mouseMoved = None 19 | mouseDragged = None 20 | mousePressed = None 21 | mouseReleased = None 22 | mouseClicked = None 23 | doubleClicked = None 24 | mouseWheel = None 25 | touchStarted = None 26 | touchMoved = None 27 | touchEnded = None 28 | windowResized = None 29 | keyIsDown = None 30 | 31 | 32 | r = None 33 | def setup(): 34 | global r 35 | 36 | createCanvas(900, 900) 37 | r = random(100, 700) 38 | noFill() 39 | 40 | 41 | def draw(): 42 | x, y = 100, 100 43 | rect(x, y, r, r) 44 | 45 | 46 | def keyPressed(): 47 | console.log("Key pressed event") 48 | 49 | if key == "n": 50 | global r 51 | r = random(100, 700) 52 | redraw() 53 | 54 | 55 | def mouseDragged(): 56 | global r 57 | r = random(100, 700) 58 | redraw() 59 | 60 | 61 | 62 | event_functions = { 63 | "deviceMoved": deviceMoved, 64 | "deviceTurned": deviceTurned, 65 | "deviceShaken": deviceShaken, 66 | "keyPressed": keyPressed, 67 | "keyReleased": keyReleased, 68 | "keyTyped": keyTyped, 69 | "mouseMoved": mouseMoved, 70 | "mouseDragged": mouseDragged, 71 | "mousePressed": mousePressed, 72 | "mouseReleased": mouseReleased, 73 | "mouseClicked": mouseClicked, 74 | "doubleClicked": doubleClicked, 75 | "mouseWheel": mouseWheel, 76 | "touchStarted": touchStarted, 77 | "touchMoved": touchMoved, 78 | "touchEnded": touchEnded, 79 | "windowResized": windowResized, 80 | "keyIsDown": keyIsDown, 81 | } 82 | 83 | start_p5(preload, setup, draw, event_functions) -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_007/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_007 - pyp5js (using Transcrypt) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 35 | 36 | 37 | 38 |

39 | Python code here. 40 |

41 | 42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |              
50 | def setup():
51 |     createCanvas(900, 900)
52 |     stroke(27, 27, 27, 10)
53 |     strokeWeight(2)
54 | 
55 | 
56 | def draw():
57 |     push()
58 | 
59 |     translate(width / 2, height / 2)
60 |     v = p5.Vector.random2D()
61 |     v.normalize()
62 |     v.mult(random(100, 400))
63 |     line(0, 0, v.x, v.y)
64 | 
65 |     pop()
66 | 
67 |               
68 |           
69 |
70 | 71 |
72 | 73 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_007/sketch_007.py: -------------------------------------------------------------------------------- 1 | def setup(): 2 | createCanvas(900, 900) 3 | stroke(27, 27, 27, 10) 4 | strokeWeight(2) 5 | 6 | 7 | def draw(): 8 | push() 9 | 10 | translate(width / 2, height / 2) 11 | v = p5.Vector.random2D() 12 | v.normalize() 13 | v.mult(random(100, 400)) 14 | line(0, 0, v.x, v.y) 15 | 16 | pop() 17 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_007/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:16 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_007/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_007/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_007/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_007/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_007/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_007/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_007/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_007/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_007/target/target_sketch.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | def preload(): 4 | pass 5 | 6 | def setup(): 7 | pass 8 | 9 | def draw(): 10 | pass 11 | 12 | deviceMoved = None 13 | deviceTurned = None 14 | deviceShaken = None 15 | keyPressed = None 16 | keyReleased = None 17 | keyTyped = None 18 | mouseMoved = None 19 | mouseDragged = None 20 | mousePressed = None 21 | mouseReleased = None 22 | mouseClicked = None 23 | doubleClicked = None 24 | mouseWheel = None 25 | touchStarted = None 26 | touchMoved = None 27 | touchEnded = None 28 | windowResized = None 29 | keyIsDown = None 30 | 31 | 32 | def setup(): 33 | createCanvas(900, 900) 34 | stroke(27, 27, 27, 10) 35 | strokeWeight(2) 36 | 37 | 38 | def draw(): 39 | push() 40 | 41 | translate(width / 2, height / 2) 42 | v = p5.Vector.random2D() 43 | v.normalize() 44 | v.mult(random(100, 400)) 45 | line(0, 0, v.x, v.y) 46 | 47 | pop() 48 | 49 | 50 | 51 | event_functions = { 52 | "deviceMoved": deviceMoved, 53 | "deviceTurned": deviceTurned, 54 | "deviceShaken": deviceShaken, 55 | "keyPressed": keyPressed, 56 | "keyReleased": keyReleased, 57 | "keyTyped": keyTyped, 58 | "mouseMoved": mouseMoved, 59 | "mouseDragged": mouseDragged, 60 | "mousePressed": mousePressed, 61 | "mouseReleased": mouseReleased, 62 | "mouseClicked": mouseClicked, 63 | "doubleClicked": doubleClicked, 64 | "mouseWheel": mouseWheel, 65 | "touchStarted": touchStarted, 66 | "touchMoved": touchMoved, 67 | "touchEnded": touchEnded, 68 | "windowResized": windowResized, 69 | "keyIsDown": keyIsDown, 70 | } 71 | 72 | start_p5(preload, setup, draw, event_functions) -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_008/sketch_008.py: -------------------------------------------------------------------------------- 1 | rect_base_size = 30 2 | positions = [] 3 | rect_size = None 4 | 5 | def setup(): 6 | global rect_size 7 | 8 | createP("Hi! This is an example of how to use p5.dom.js with pyp5js") 9 | 10 | # creates a container div 11 | slider_div = createDiv() 12 | slider_div.style("display", "block") 13 | 14 | # creates the slider 15 | rect_size = createSlider(0, 600, 100) 16 | rect_size.style('width', '50%') 17 | 18 | # adds the slider to the container div 19 | slider_div.child(rect_size) 20 | 21 | createCanvas(600, 600) 22 | 23 | for x in range(-rect_base_size, width + rect_base_size, rect_base_size): 24 | for y in range(-rect_base_size, height + rect_base_size, rect_base_size): 25 | positions.append((x, y)) 26 | 27 | noFill() 28 | strokeWeight(2) 29 | rectMode(CENTER) 30 | 31 | 32 | def draw(): 33 | background(255) 34 | size = rect_size.value() 35 | for x, y in positions: 36 | rect(x, y, size, size) 37 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_008/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:17 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_008/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_008/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_008/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_008/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_008/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_008/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_008/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_008/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_008/target/target_sketch.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | def preload(): 4 | pass 5 | 6 | def setup(): 7 | pass 8 | 9 | def draw(): 10 | pass 11 | 12 | deviceMoved = None 13 | deviceTurned = None 14 | deviceShaken = None 15 | keyPressed = None 16 | keyReleased = None 17 | keyTyped = None 18 | mouseMoved = None 19 | mouseDragged = None 20 | mousePressed = None 21 | mouseReleased = None 22 | mouseClicked = None 23 | doubleClicked = None 24 | mouseWheel = None 25 | touchStarted = None 26 | touchMoved = None 27 | touchEnded = None 28 | windowResized = None 29 | keyIsDown = None 30 | 31 | 32 | rect_base_size = 30 33 | positions = [] 34 | rect_size = None 35 | 36 | def setup(): 37 | global rect_size 38 | 39 | createP("Hi! This is an example of how to use p5.dom.js with pyp5js") 40 | 41 | # creates a container div 42 | slider_div = createDiv() 43 | slider_div.style("display", "block") 44 | 45 | # creates the slider 46 | rect_size = createSlider(0, 600, 100) 47 | rect_size.style('width', '50%') 48 | 49 | # adds the slider to the container div 50 | slider_div.child(rect_size) 51 | 52 | createCanvas(600, 600) 53 | 54 | for x in range(-rect_base_size, width + rect_base_size, rect_base_size): 55 | for y in range(-rect_base_size, height + rect_base_size, rect_base_size): 56 | positions.append((x, y)) 57 | 58 | noFill() 59 | strokeWeight(2) 60 | rectMode(CENTER) 61 | 62 | 63 | def draw(): 64 | background(255) 65 | size = rect_size.value() 66 | for x, y in positions: 67 | rect(x, y, size, size) 68 | 69 | 70 | 71 | event_functions = { 72 | "deviceMoved": deviceMoved, 73 | "deviceTurned": deviceTurned, 74 | "deviceShaken": deviceShaken, 75 | "keyPressed": keyPressed, 76 | "keyReleased": keyReleased, 77 | "keyTyped": keyTyped, 78 | "mouseMoved": mouseMoved, 79 | "mouseDragged": mouseDragged, 80 | "mousePressed": mousePressed, 81 | "mouseReleased": mouseReleased, 82 | "mouseClicked": mouseClicked, 83 | "doubleClicked": doubleClicked, 84 | "mouseWheel": mouseWheel, 85 | "touchStarted": touchStarted, 86 | "touchMoved": touchMoved, 87 | "touchEnded": touchEnded, 88 | "windowResized": windowResized, 89 | "keyIsDown": keyIsDown, 90 | } 91 | 92 | start_p5(preload, setup, draw, event_functions) -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/alien.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/transcrypt/sketch_009/alien.png -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | sketch_009 - pyp5js (using Transcrypt) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 35 | 36 | 37 | 38 |

39 | Python code here. 40 |

41 | 42 |
43 |
44 | 45 |
46 | 47 |
48 |
49 |              
50 | from random import choice
51 | 
52 | 
53 | images = []
54 | 
55 | def setup():
56 |     global images
57 | 
58 |     createP("Click to add a new image")
59 |     createCanvas(600, 600)
60 |     background(200)
61 |     images = [
62 |         loadImage('smile.png'),
63 |         loadImage('alien.png'),
64 |         loadImage('rainbow.png'),
65 |     ]
66 | 
67 | 
68 | def mousePressed():
69 |     x, y = mouseX, mouseY
70 |     img = choice(images)
71 |     image(img, x, y)
72 | 
73 | 
74 | def draw():
75 |     pass
76 | 
77 |               
78 |           
79 |
80 | 81 |
82 | 83 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/transcrypt/sketch_009/rainbow.png -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/sketch_009.py: -------------------------------------------------------------------------------- 1 | from random import choice 2 | 3 | 4 | images = [] 5 | 6 | def setup(): 7 | global images 8 | 9 | createP("Click to add a new image") 10 | createCanvas(600, 600) 11 | background(200) 12 | images = [ 13 | loadImage('smile.png'), 14 | loadImage('alien.png'), 15 | loadImage('rainbow.png'), 16 | ] 17 | 18 | 19 | def mousePressed(): 20 | x, y = mouseX, mouseY 21 | img = choice(images) 22 | image(img, x, y) 23 | 24 | 25 | def draw(): 26 | pass 27 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/smile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/docs/examples/transcrypt/sketch_009/smile.png -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/target/math.py: -------------------------------------------------------------------------------- 1 | pi = Math.PI 2 | e = Math.E 3 | 4 | exp = Math.exp 5 | 6 | def expm1 (x): # IE workaround 7 | return Math.exp (x) - 1 8 | 9 | def log (x, base): 10 | return Math.log (x) if base is js_undefined else Math.log (x) / Math.log (base) 11 | 12 | def log1p (x): # IE workaround 13 | return Math.log (x + 1) 14 | 15 | def log2 (x): # IE workaround 16 | return Math.log (x) / Math.LN2 17 | 18 | def log10 (x): # IE workaround 19 | return Math.log (x) / Math.LN10 20 | 21 | pow = Math.pow 22 | sqrt = Math.sqrt 23 | 24 | sin = Math.sin 25 | cos = Math.cos 26 | tan = Math.tan 27 | 28 | asin = Math.asin 29 | acos = Math.acos 30 | atan = Math.atan 31 | atan2 = Math.atan2 32 | 33 | hypot = Math.hypot 34 | 35 | def degrees (x): 36 | return x * 180 / Math.PI 37 | 38 | def radians (x): 39 | return x * Math.PI / 180 40 | 41 | sinh = Math.sinh 42 | cosh = Math.cosh 43 | tanh = Math.tanh 44 | 45 | asinh = Math.asinh 46 | acosh = Math.acosh 47 | atanh = Math.atanh 48 | 49 | floor = Math.floor 50 | ceil = Math.ceil 51 | trunc = Math.trunc 52 | 53 | isnan = js_isNaN 54 | 55 | inf = js_Infinity 56 | nan = js_NaN 57 | 58 | def modf(n): 59 | sign = 1 if n >= 0 else -1 60 | f, mod = divmod (abs(n), 1) 61 | return mod * sign, f * sign 62 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:18 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/target/random.py: -------------------------------------------------------------------------------- 1 | # Mersenne-Twister random number algorithm 2 | 3 | import math 4 | 5 | _array = [0 for i in range (624)] 6 | _index = 0 7 | _bitmask1 = (2 ** 32) - 1 8 | _bitmask2 = 2 ** 31 9 | _bitmask3 = (2 ** 31) - 1 10 | 11 | def _fill_array(): 12 | global _array 13 | for i in range (624): 14 | y = (_array [i] & _bitmask2) + (_array [(i + 1) % 624] & _bitmask3) 15 | _array [i] = _array [(i + 397) % 624] ^ (y >> 1) 16 | if y % 2 != 0: 17 | _array[i] ^= 2567483615 18 | 19 | def _random_integer (): 20 | global _index 21 | global _array 22 | if _index == 0: 23 | _fill_array () 24 | y = _array [_index] 25 | y ^= y >> 11 26 | y ^= (y << 7) & 2636928640 27 | y ^= (y << 15) & 4022730752 28 | y ^= y >> 18 29 | 30 | _index = (_index + 1) % 624 31 | return y 32 | 33 | def seed (x = int (_bitmask3 * Math.random ())): 34 | global _array 35 | global _bitmask1 36 | _array [0] = x 37 | for i in range (1, 624): 38 | _array [i] = ((1812433253 * _array [i - 1]) ^ ((_array [i - 1] >> 30) + i)) & _bitmask1 39 | 40 | def randint (a, b): 41 | return a + _random_integer () % (b - a + 1) 42 | 43 | def choice (seq): 44 | return seq [randint (0, len (seq) - 1)] 45 | 46 | def random (): 47 | return _random_integer () / _bitmask3 48 | 49 | def shuffle (x): # Fisher-Yates unbiased shuffle 50 | for i in range (len (x) - 1, 0, -1): 51 | j = math.floor (random () * (i + 1)) 52 | temp = x [i] 53 | x [i] = x [j] 54 | x [j] = temp 55 | 56 | seed () 57 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/__target__/target_sketch.js"}, {"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/random/__init__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/__target__/random.js"}, {"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/math/__init__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/__target__/math.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_009/target/target_sketch.py: -------------------------------------------------------------------------------- 1 | from pyp5js import * 2 | 3 | def preload(): 4 | pass 5 | 6 | def setup(): 7 | pass 8 | 9 | def draw(): 10 | pass 11 | 12 | deviceMoved = None 13 | deviceTurned = None 14 | deviceShaken = None 15 | keyPressed = None 16 | keyReleased = None 17 | keyTyped = None 18 | mouseMoved = None 19 | mouseDragged = None 20 | mousePressed = None 21 | mouseReleased = None 22 | mouseClicked = None 23 | doubleClicked = None 24 | mouseWheel = None 25 | touchStarted = None 26 | touchMoved = None 27 | touchEnded = None 28 | windowResized = None 29 | keyIsDown = None 30 | 31 | 32 | from random import choice 33 | 34 | 35 | images = [] 36 | 37 | def setup(): 38 | global images 39 | 40 | createP("Click to add a new image") 41 | createCanvas(600, 600) 42 | background(200) 43 | images = [ 44 | loadImage('smile.png'), 45 | loadImage('alien.png'), 46 | loadImage('rainbow.png'), 47 | ] 48 | 49 | 50 | def mousePressed(): 51 | x, y = mouseX, mouseY 52 | img = choice(images) 53 | image(img, x, y) 54 | 55 | 56 | def draw(): 57 | pass 58 | 59 | 60 | 61 | event_functions = { 62 | "deviceMoved": deviceMoved, 63 | "deviceTurned": deviceTurned, 64 | "deviceShaken": deviceShaken, 65 | "keyPressed": keyPressed, 66 | "keyReleased": keyReleased, 67 | "keyTyped": keyTyped, 68 | "mouseMoved": mouseMoved, 69 | "mouseDragged": mouseDragged, 70 | "mousePressed": mousePressed, 71 | "mouseReleased": mouseReleased, 72 | "mouseClicked": mouseClicked, 73 | "doubleClicked": doubleClicked, 74 | "mouseWheel": mouseWheel, 75 | "touchStarted": touchStarted, 76 | "touchMoved": touchMoved, 77 | "touchEnded": touchEnded, 78 | "windowResized": windowResized, 79 | "keyIsDown": keyIsDown, 80 | } 81 | 82 | start_p5(preload, setup, draw, event_functions) -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_010/target/python_functions.js: -------------------------------------------------------------------------------- 1 | // Transcrypt'ed from Python, 2021-11-02 13:06:19 2 | import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, abs, all, any, assert, bool, bytearray, bytes, callable, chr, copy, deepcopy, delattr, dict, dir, divmod, enumerate, filter, float, getattr, hasattr, input, int, isinstance, issubclass, len, list, map, max, min, object, ord, pow, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, round, set, setattr, sorted, str, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; 3 | var __name__ = 'python_functions'; 4 | export var PythonFunctions = __class__ ('PythonFunctions', [object], { 5 | __module__: __name__, 6 | }); 7 | setattr (PythonFunctions, 'map', map); 8 | setattr (PythonFunctions, 'filter', filter); 9 | setattr (PythonFunctions, 'set', set); 10 | 11 | //# sourceMappingURL=python_functions.map -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_010/target/python_functions.py: -------------------------------------------------------------------------------- 1 | class PythonFunctions: pass 2 | 3 | setattr(PythonFunctions, 'map', map) 4 | setattr(PythonFunctions, 'filter', filter) 5 | setattr(PythonFunctions, 'set', set) 6 | -------------------------------------------------------------------------------- /docs/examples/transcrypt/sketch_010/target/target_sketch.project: -------------------------------------------------------------------------------- 1 | {"options": {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_010/target_sketch.py", "anno": false, "alimod": false, "build": true, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": false, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": true, "keycheck": false, "license": false, "map": true, "nomin": true, "opov": false, "outdir": null, "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt", "xtiny": false, "star": false}, "modules": [{"source": "/home/bernardo/.pyenv/versions/pyp5js/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_010/__target__/org.transcrypt.__runtime__.js"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_010/target_sketch.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_010/__target__/target_sketch.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/pyp5js.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_010/__target__/pyp5js.js"}, {"source": "/home/bernardo/envs/pyp5js/pyp5js/templates/transcrypt/python_functions.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_010/__target__/python_functions.js"}]} -------------------------------------------------------------------------------- /docs/pyodide/pyodide.py: -------------------------------------------------------------------------------- 1 | def setup(): 2 | createCanvas(200, 200) 3 | 4 | def draw(): 5 | background(200) 6 | diameter = sin(frameCount / 60) * 50 + 50 7 | fill("blue") 8 | ellipse(100, 100, diameter, diameter) 9 | -------------------------------------------------------------------------------- /docs/pyodide/share.js: -------------------------------------------------------------------------------- 1 | function createSketchUrl() { 2 | const baseUrl = window.location.origin + window.location.pathname; 3 | const userCode = editor.getSession().getValue(); 4 | 5 | const encodedUserCode = btoa(encodeURIComponent(userCode)); 6 | 7 | const sketchUrl = new URL(baseUrl); 8 | sketchUrl.searchParams.append("sketch", encodedUserCode); 9 | 10 | return sketchUrl; 11 | } 12 | 13 | function decodeSketchUrl(encodedSketch) { 14 | const decodedSketch = decodeURIComponent(atob(encodedSketch)); 15 | 16 | return decodedSketch; 17 | } 18 | 19 | function checkForSketch() { 20 | let initialSketch = `def setup(): 21 | createCanvas(200, 200) 22 | 23 | def draw(): 24 | background(200) 25 | diameter = sin(frameCount / 60) * 50 + 50 26 | fill("blue") 27 | ellipse(100, 100, diameter, diameter) 28 | `; 29 | 30 | const currentUrl = new URLSearchParams(window.location.search); 31 | 32 | if (currentUrl.has("sketch")) { 33 | initialSketch = decodeSketchUrl(currentUrl.get("sketch")); 34 | } 35 | 36 | return initialSketch; 37 | } 38 | 39 | // Made by user Dean Taylor in 40 | // https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript 41 | 42 | function fallbackCopyTextToClipboard(text) { 43 | var textArea = document.createElement("textarea"); 44 | textArea.value = text; 45 | 46 | // Avoid scrolling to bottom 47 | textArea.style.top = "0"; 48 | textArea.style.left = "0"; 49 | textArea.style.position = "fixed"; 50 | 51 | document.body.appendChild(textArea); 52 | textArea.focus(); 53 | textArea.select(); 54 | 55 | try { 56 | document.execCommand("copy"); 57 | } catch (err) { 58 | console.error("Fallback: Oops, unable to copy URL", err); 59 | } 60 | 61 | document.body.removeChild(textArea); 62 | } 63 | 64 | function copyTextToClipboard(text) { 65 | if (!navigator.clipboard) { 66 | fallbackCopyTextToClipboard(text); 67 | return; 68 | } 69 | navigator.clipboard.writeText(text).then( 70 | function () { 71 | return; 72 | }, 73 | function (err) { 74 | console.error("Async: Could not copy URL: ", err); 75 | } 76 | ); 77 | } 78 | -------------------------------------------------------------------------------- /docs/pyodide/styles.css: -------------------------------------------------------------------------------- 1 | body, 2 | html, 3 | canvas { 4 | padding: 0; 5 | margin: 0; 6 | } 7 | 8 | html { 9 | overflow-y: scroll; 10 | overflow-x: scroll; 11 | } 12 | 13 | .demoContainer { 14 | display: flex; 15 | } 16 | 17 | pre { 18 | margin-right: 2em; 19 | } 20 | 21 | .text-editor-box { 22 | margin: 0 1.5em; 23 | max-width: 800px; 24 | display: flex; 25 | flex-direction: column; 26 | align-items: flex-end; 27 | } 28 | 29 | #text-editor { 30 | float: left; 31 | margin: 0.5em 0; 32 | height: 600px; 33 | border: 1px solid #ccc; 34 | border-radius: 8px; 35 | } 36 | 37 | .text-editor { 38 | width: 700px; 39 | transition-property: width; 40 | transition: 500ms ease-out; 41 | } 42 | 43 | #sketch-buttons { 44 | width: 100%; 45 | min-width: 250px; 46 | display: flex; 47 | justify-content: space-between; 48 | align-self: flex-start; 49 | } 50 | 51 | .left-buttons { 52 | width: 100%; 53 | } 54 | 55 | .hidden-editor { 56 | opacity: 0.2; 57 | width: 250px; 58 | transition-property: width; 59 | transition: 500ms ease-in; 60 | } 61 | 62 | .code-container { 63 | display: flex; 64 | align-items: flex-start; 65 | justify-content: flex-start; 66 | } 67 | 68 | .display-none { 69 | display: none; 70 | } 71 | -------------------------------------------------------------------------------- /pyp5js/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | -------------------------------------------------------------------------------- /pyp5js/config/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | from . import sketch 19 | from .sketch import TRANSCRYPT_INTERPRETER, PYODIDE_INTERPRETER 20 | from decouple import config 21 | from pathlib import Path 22 | 23 | SKETCHBOOK_DIR = config("SKETCHBOOK_DIR", cast=Path, default=Path.home().joinpath('sketchbook-pyp5js')) 24 | 25 | if not SKETCHBOOK_DIR.exists(): 26 | SKETCHBOOK_DIR.mkdir() 27 | 28 | AVAILABLE_INTERPRETERS = [TRANSCRYPT_INTERPRETER, PYODIDE_INTERPRETER] 29 | -------------------------------------------------------------------------------- /pyp5js/exceptions.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | class PythonSketchDoesNotExist(Exception): 19 | 20 | def __init__(self, sketch): 21 | sketch_py = sketch.sketch_py.resolve() 22 | message = f"Sketch file {sketch_py} does not exist" 23 | super().__init__(message) 24 | 25 | 26 | class SketchDirAlreadyExistException(Exception): 27 | 28 | def __init__(self, sketch): 29 | sketch_dir = sketch.sketch_dir.resolve() 30 | message = f'The directory {sketch_dir} already exists.' 31 | super().__init__(message) 32 | 33 | class InvalidName(Exception): 34 | 35 | def __init__(self, sketch): 36 | sketch_name = sketch.sketch_name 37 | message = f'The name {sketch_name} must start with a letter or an underscore and ' + \ 38 | 'contain alphanumeric and underscore characters only.' 39 | super().__init__(message) 40 | -------------------------------------------------------------------------------- /pyp5js/http_local/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/ext-error_marker.js: -------------------------------------------------------------------------------- 1 | ; (function() { 2 | window.require(["ace/ext/error_marker"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/ext-linking.js: -------------------------------------------------------------------------------- 1 | define("ace/ext/linking",["require","exports","module","ace/editor","ace/config"],function(e,t,n){function i(e){var n=e.editor,r=e.getAccelKey();if(r){var n=e.editor,i=e.getDocumentPosition(),s=n.session,o=s.getTokenAt(i.row,i.column);t.previousLinkingHover&&t.previousLinkingHover!=o&&n._emit("linkHoverOut"),n._emit("linkHover",{position:i,token:o}),t.previousLinkingHover=o}else t.previousLinkingHover&&(n._emit("linkHoverOut"),t.previousLinkingHover=!1)}function s(e){var t=e.getAccelKey(),n=e.getButton();if(n==0&&t){var r=e.editor,i=e.getDocumentPosition(),s=r.session,o=s.getTokenAt(i.row,i.column);r._emit("linkClick",{position:i,token:o})}}var r=e("../editor").Editor;e("../config").defineOptions(r.prototype,"editor",{enableLinking:{set:function(e){e?(this.on("click",s),this.on("mousemove",i)):(this.off("click",s),this.off("mousemove",i))},value:!1}}),t.previousLinkingHover=!1}); (function() { 2 | window.require(["ace/ext/linking"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/ext-rtl.js: -------------------------------------------------------------------------------- 1 | define("ace/ext/rtl",["require","exports","module","ace/editor","ace/config"],function(e,t,n){"use strict";function s(e,t){var n=t.getSelection().lead;t.session.$bidiHandler.isRtlLine(n.row)&&n.column===0&&(t.session.$bidiHandler.isMoveLeftOperation&&n.row>0?t.getSelection().moveCursorTo(n.row-1,t.session.getLine(n.row-1).length):t.getSelection().isEmpty()?n.column+=1:n.setPosition(n.row,n.column+1))}function o(e){e.editor.session.$bidiHandler.isMoveLeftOperation=/gotoleft|selectleft|backspace|removewordleft/.test(e.command.name)}function u(e,t){var n=t.session;n.$bidiHandler.currentRow=null;if(n.$bidiHandler.isRtlLine(e.start.row)&&e.action==="insert"&&e.lines.length>1)for(var r=e.start.row;r span {font-weight: normal !important;}.ace-github .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-github .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-github .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-github .ace_gutter-active-line {background-color : rgba(0, 0, 0, 0.07);}.ace-github .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-github .ace_invisible {color: #BFBFBF}.ace-github .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-github .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}';var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/github"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/theme-gruvbox.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/gruvbox",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-gruvbox",t.cssText='.ace-gruvbox .ace_gutter-active-line {background-color: #3C3836;}.ace-gruvbox {color: #EBDAB4;background-color: #1D2021;}.ace-gruvbox .ace_invisible {color: #504945;}.ace-gruvbox .ace_marker-layer .ace_selection {background: rgba(179, 101, 57, 0.75)}.ace-gruvbox.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #002240;}.ace-gruvbox .ace_keyword {color: #8ec07c;}.ace-gruvbox .ace_comment {font-style: italic;color: #928375;}.ace-gruvbox .ace-statement {color: red;}.ace-gruvbox .ace_variable {color: #84A598;}.ace-gruvbox .ace_variable.ace_language {color: #D2879B;}.ace-gruvbox .ace_constant {color: #C2859A;}.ace-gruvbox .ace_constant.ace_language {color: #C2859A;}.ace-gruvbox .ace_constant.ace_numeric {color: #C2859A;}.ace-gruvbox .ace_string {color: #B8BA37;}.ace-gruvbox .ace_support {color: #F9BC41;}.ace-gruvbox .ace_support.ace_function {color: #F84B3C;}.ace-gruvbox .ace_storage {color: #8FBF7F;}.ace-gruvbox .ace_keyword.ace_operator {color: #EBDAB4;}.ace-gruvbox .ace_punctuation.ace_operator {color: yellow;}.ace-gruvbox .ace_marker-layer .ace_active-line {background: #3C3836;}.ace-gruvbox .ace_marker-layer .ace_selected-word {border-radius: 4px;border: 8px solid #3f475d;}.ace-gruvbox .ace_print-margin {width: 5px;background: #3C3836;}.ace-gruvbox .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNQUFD4z6Crq/sfAAuYAuYl+7lfAAAAAElFTkSuQmCC") right repeat-y;}';var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/gruvbox"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/theme-idle_fingers.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/idle_fingers",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-idle-fingers",t.cssText=".ace-idle-fingers .ace_gutter {background: #3b3b3b;color: rgb(153,153,153)}.ace-idle-fingers .ace_print-margin {width: 1px;background: #3b3b3b}.ace-idle-fingers {background-color: #323232;color: #FFFFFF}.ace-idle-fingers .ace_cursor {color: #91FF00}.ace-idle-fingers .ace_marker-layer .ace_selection {background: rgba(90, 100, 126, 0.88)}.ace-idle-fingers.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #323232;}.ace-idle-fingers .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-idle-fingers .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #404040}.ace-idle-fingers .ace_marker-layer .ace_active-line {background: #353637}.ace-idle-fingers .ace_gutter-active-line {background-color: #353637}.ace-idle-fingers .ace_marker-layer .ace_selected-word {border: 1px solid rgba(90, 100, 126, 0.88)}.ace-idle-fingers .ace_invisible {color: #404040}.ace-idle-fingers .ace_keyword,.ace-idle-fingers .ace_meta {color: #CC7833}.ace-idle-fingers .ace_constant,.ace-idle-fingers .ace_constant.ace_character,.ace-idle-fingers .ace_constant.ace_character.ace_escape,.ace-idle-fingers .ace_constant.ace_other,.ace-idle-fingers .ace_support.ace_constant {color: #6C99BB}.ace-idle-fingers .ace_invalid {color: #FFFFFF;background-color: #FF0000}.ace-idle-fingers .ace_fold {background-color: #CC7833;border-color: #FFFFFF}.ace-idle-fingers .ace_support.ace_function {color: #B83426}.ace-idle-fingers .ace_variable.ace_parameter {font-style: italic}.ace-idle-fingers .ace_string {color: #A5C261}.ace-idle-fingers .ace_string.ace_regexp {color: #CCCC33}.ace-idle-fingers .ace_comment {font-style: italic;color: #BC9458}.ace-idle-fingers .ace_meta.ace_tag {color: #FFE5BB}.ace-idle-fingers .ace_entity.ace_name {color: #FFC66D}.ace-idle-fingers .ace_collab.ace_user1 {color: #323232;background-color: #FFF980}.ace-idle-fingers .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMwMjLyZYiPj/8PAAreAwAI1+g0AAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/idle_fingers"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/theme-kr_theme.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/kr_theme",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-kr-theme",t.cssText=".ace-kr-theme .ace_gutter {background: #1c1917;color: #FCFFE0}.ace-kr-theme .ace_print-margin {width: 1px;background: #1c1917}.ace-kr-theme {background-color: #0B0A09;color: #FCFFE0}.ace-kr-theme .ace_cursor {color: #FF9900}.ace-kr-theme .ace_marker-layer .ace_selection {background: rgba(170, 0, 255, 0.45)}.ace-kr-theme.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #0B0A09;}.ace-kr-theme .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-kr-theme .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(255, 177, 111, 0.32)}.ace-kr-theme .ace_marker-layer .ace_active-line {background: #38403D}.ace-kr-theme .ace_gutter-active-line {background-color : #38403D}.ace-kr-theme .ace_marker-layer .ace_selected-word {border: 1px solid rgba(170, 0, 255, 0.45)}.ace-kr-theme .ace_invisible {color: rgba(255, 177, 111, 0.32)}.ace-kr-theme .ace_keyword,.ace-kr-theme .ace_meta {color: #949C8B}.ace-kr-theme .ace_constant,.ace-kr-theme .ace_constant.ace_character,.ace-kr-theme .ace_constant.ace_character.ace_escape,.ace-kr-theme .ace_constant.ace_other {color: rgba(210, 117, 24, 0.76)}.ace-kr-theme .ace_invalid {color: #F8F8F8;background-color: #A41300}.ace-kr-theme .ace_support {color: #9FC28A}.ace-kr-theme .ace_support.ace_constant {color: #C27E66}.ace-kr-theme .ace_fold {background-color: #949C8B;border-color: #FCFFE0}.ace-kr-theme .ace_support.ace_function {color: #85873A}.ace-kr-theme .ace_storage {color: #FFEE80}.ace-kr-theme .ace_string {color: rgba(164, 161, 181, 0.8)}.ace-kr-theme .ace_string.ace_regexp {color: rgba(125, 255, 192, 0.65)}.ace-kr-theme .ace_comment {font-style: italic;color: #706D5B}.ace-kr-theme .ace_variable {color: #D1A796}.ace-kr-theme .ace_list,.ace-kr-theme .ace_markup.ace_list {background-color: #0F0040}.ace-kr-theme .ace_variable.ace_language {color: #FF80E1}.ace-kr-theme .ace_meta.ace_tag {color: #BABD9C}.ace-kr-theme .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYFBXV/8PAAJoAXX4kT2EAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/kr_theme"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/theme-kuroir.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/kuroir",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!1,t.cssClass="ace-kuroir",t.cssText=".ace-kuroir .ace_gutter {background: #e8e8e8;color: #333;}.ace-kuroir .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-kuroir {background-color: #E8E9E8;color: #363636;}.ace-kuroir .ace_cursor {color: #202020;}.ace-kuroir .ace_marker-layer .ace_selection {background: rgba(245, 170, 0, 0.57);}.ace-kuroir.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #E8E9E8;}.ace-kuroir .ace_marker-layer .ace_step {background: rgb(198, 219, 174);}.ace-kuroir .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(0, 0, 0, 0.29);}.ace-kuroir .ace_marker-layer .ace_active-line {background: rgba(203, 220, 47, 0.22);}.ace-kuroir .ace_gutter-active-line {background-color: rgba(203, 220, 47, 0.22);}.ace-kuroir .ace_marker-layer .ace_selected-word {border: 1px solid rgba(245, 170, 0, 0.57);}.ace-kuroir .ace_invisible {color: #BFBFBF}.ace-kuroir .ace_fold {border-color: #363636;}.ace-kuroir .ace_constant{color:#CD6839;}.ace-kuroir .ace_constant.ace_numeric{color:#9A5925;}.ace-kuroir .ace_support{color:#104E8B;}.ace-kuroir .ace_support.ace_function{color:#005273;}.ace-kuroir .ace_support.ace_constant{color:#CF6A4C;}.ace-kuroir .ace_storage{color:#A52A2A;}.ace-kuroir .ace_invalid.ace_illegal{color:#FD1224;background-color:rgba(255, 6, 0, 0.15);}.ace-kuroir .ace_invalid.ace_deprecated{text-decoration:underline;font-style:italic;color:#FD1732;background-color:#E8E9E8;}.ace-kuroir .ace_string{color:#639300;}.ace-kuroir .ace_string.ace_regexp{color:#417E00;background-color:#C9D4BE;}.ace-kuroir .ace_comment{color:rgba(148, 148, 148, 0.91);background-color:rgba(220, 220, 220, 0.56);}.ace-kuroir .ace_variable{color:#009ACD;}.ace-kuroir .ace_meta.ace_tag{color:#005273;}.ace-kuroir .ace_markup.ace_heading{color:#B8012D;background-color:rgba(191, 97, 51, 0.051);}.ace-kuroir .ace_markup.ace_list{color:#8F5B26;}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/kuroir"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/theme-merbivore.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/merbivore",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-merbivore",t.cssText=".ace-merbivore .ace_gutter {background: #202020;color: #E6E1DC}.ace-merbivore .ace_print-margin {width: 1px;background: #555651}.ace-merbivore {background-color: #161616;color: #E6E1DC}.ace-merbivore .ace_cursor {color: #FFFFFF}.ace-merbivore .ace_marker-layer .ace_selection {background: #454545}.ace-merbivore.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #161616;}.ace-merbivore .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-merbivore .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #404040}.ace-merbivore .ace_marker-layer .ace_active-line {background: #333435}.ace-merbivore .ace_gutter-active-line {background-color: #333435}.ace-merbivore .ace_marker-layer .ace_selected-word {border: 1px solid #454545}.ace-merbivore .ace_invisible {color: #404040}.ace-merbivore .ace_entity.ace_name.ace_tag,.ace-merbivore .ace_keyword,.ace-merbivore .ace_meta,.ace-merbivore .ace_meta.ace_tag,.ace-merbivore .ace_storage,.ace-merbivore .ace_support.ace_function {color: #FC6F09}.ace-merbivore .ace_constant,.ace-merbivore .ace_constant.ace_character,.ace-merbivore .ace_constant.ace_character.ace_escape,.ace-merbivore .ace_constant.ace_other,.ace-merbivore .ace_support.ace_type {color: #1EDAFB}.ace-merbivore .ace_constant.ace_character.ace_escape {color: #519F50}.ace-merbivore .ace_constant.ace_language {color: #FDC251}.ace-merbivore .ace_constant.ace_library,.ace-merbivore .ace_string,.ace-merbivore .ace_support.ace_constant {color: #8DFF0A}.ace-merbivore .ace_constant.ace_numeric {color: #58C554}.ace-merbivore .ace_invalid {color: #FFFFFF;background-color: #990000}.ace-merbivore .ace_fold {background-color: #FC6F09;border-color: #E6E1DC}.ace-merbivore .ace_comment {font-style: italic;color: #AD2EA4}.ace-merbivore .ace_entity.ace_other.ace_attribute-name {color: #FFFF89}.ace-merbivore .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQFxf3ZXB1df0PAAdsAmERTkEHAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/merbivore"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/theme-nord_dark.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/nord_dark",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-nord-dark",t.cssText=".ace-nord-dark .ace_gutter {color: #616e88;}.ace-nord-dark .ace_print-margin {width: 1px;background: #4c566a;}.ace-nord-dark {background-color: #2e3440;color: #d8dee9;}.ace-nord-dark .ace_entity.ace_other.ace_attribute-name,.ace-nord-dark .ace_storage {color: #d8dee9;}.ace-nord-dark .ace_cursor {color: #d8dee9;},.ace-nord-dark .ace_string.ace_regexp {color: #bf616a;}.ace-nord-dark .ace_marker-layer .ace_active-line {background: #434c5ecc;}.ace-nord-dark .ace_marker-layer .ace_selection {background: #434c5ecc;}.ace-nord-dark.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #2e3440;}.ace-nord-dark .ace_marker-layer .ace_step {background: #ebcb8b;}.ace-nord-dark .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #88c0d066;}.ace-nord-dark .ace_gutter-active-line {background-color: #434c5ecc;}.ace-nord-dark .ace_marker-layer .ace_selected-word {border: 1px solid #88c0d066;}.ace-nord-dark .ace_invisible {color: #4c566a;}.ace-nord-dark .ace_keyword,.ace-nord-dark .ace_meta,.ace-nord-dark .ace_support.ace_class,.ace-nord-dark .ace_support.ace_type {color: #81a1c1;}.ace-nord-dark .ace_constant.ace_character,.ace-nord-dark .ace_constant.ace_other {color: #d8dee9;}.ace-nord-dark .ace_constant.ace_language {color: #5e81ac;}.ace-nord-dark .ace_constant.ace_escape {color: #ebcB8b;}.ace-nord-dark .ace_constant.ace_numeric {color: #b48ead;}.ace-nord-dark .ace_fold {background-color: #4c566a;border-color: #d8dee9;}.ace-nord-dark .ace_entity.ace_name.ace_function,.ace-nord-dark .ace_entity.ace_name.ace_tag,.ace-nord-dark .ace_support.ace_function,.ace-nord-dark .ace_variable,.ace-nord-dark .ace_variable.ace_language {color: #8fbcbb;}.ace-nord-dark .ace_string {color: #a3be8c;}.ace-nord-dark .ace_comment {color: #616e88;}.ace-nord-dark .ace_indent-guide {box-shadow: inset -1px 0 0 0 #434c5eb3;}",t.$selectionColorConflict=!0;var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/nord_dark"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/theme-solarized_dark.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/solarized_dark",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-solarized-dark",t.cssText=".ace-solarized-dark .ace_gutter {background: #01313f;color: #d0edf7}.ace-solarized-dark .ace_print-margin {width: 1px;background: #33555E}.ace-solarized-dark {background-color: #002B36;color: #93A1A1}.ace-solarized-dark .ace_entity.ace_other.ace_attribute-name,.ace-solarized-dark .ace_storage {color: #93A1A1}.ace-solarized-dark .ace_cursor,.ace-solarized-dark .ace_string.ace_regexp {color: #D30102}.ace-solarized-dark .ace_marker-layer .ace_active-line,.ace-solarized-dark .ace_marker-layer .ace_selection {background: rgba(255, 255, 255, 0.1)}.ace-solarized-dark.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #002B36;}.ace-solarized-dark .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-solarized-dark .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(147, 161, 161, 0.50)}.ace-solarized-dark .ace_gutter-active-line {background-color: #0d3440}.ace-solarized-dark .ace_marker-layer .ace_selected-word {border: 1px solid #073642}.ace-solarized-dark .ace_invisible {color: rgba(147, 161, 161, 0.50)}.ace-solarized-dark .ace_keyword,.ace-solarized-dark .ace_meta,.ace-solarized-dark .ace_support.ace_class,.ace-solarized-dark .ace_support.ace_type {color: #859900}.ace-solarized-dark .ace_constant.ace_character,.ace-solarized-dark .ace_constant.ace_other {color: #CB4B16}.ace-solarized-dark .ace_constant.ace_language {color: #B58900}.ace-solarized-dark .ace_constant.ace_numeric {color: #D33682}.ace-solarized-dark .ace_fold {background-color: #268BD2;border-color: #93A1A1}.ace-solarized-dark .ace_entity.ace_name.ace_function,.ace-solarized-dark .ace_entity.ace_name.ace_tag,.ace-solarized-dark .ace_support.ace_function,.ace-solarized-dark .ace_variable,.ace-solarized-dark .ace_variable.ace_language {color: #268BD2}.ace-solarized-dark .ace_string {color: #2AA198}.ace-solarized-dark .ace_comment {font-style: italic;color: #657B83}.ace-solarized-dark .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNg0Db1ZVCxc/sPAAd4AlUHlLenAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/solarized_dark"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/theme-vibrant_ink.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/vibrant_ink",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-vibrant-ink",t.cssText=".ace-vibrant-ink .ace_gutter {background: #1a1a1a;color: #BEBEBE}.ace-vibrant-ink .ace_print-margin {width: 1px;background: #1a1a1a}.ace-vibrant-ink {background-color: #0F0F0F;color: #FFFFFF}.ace-vibrant-ink .ace_cursor {color: #FFFFFF}.ace-vibrant-ink .ace_marker-layer .ace_selection {background: #6699CC}.ace-vibrant-ink.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #0F0F0F;}.ace-vibrant-ink .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-vibrant-ink .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #404040}.ace-vibrant-ink .ace_marker-layer .ace_active-line {background: #333333}.ace-vibrant-ink .ace_gutter-active-line {background-color: #333333}.ace-vibrant-ink .ace_marker-layer .ace_selected-word {border: 1px solid #6699CC}.ace-vibrant-ink .ace_invisible {color: #404040}.ace-vibrant-ink .ace_keyword,.ace-vibrant-ink .ace_meta {color: #FF6600}.ace-vibrant-ink .ace_constant,.ace-vibrant-ink .ace_constant.ace_character,.ace-vibrant-ink .ace_constant.ace_character.ace_escape,.ace-vibrant-ink .ace_constant.ace_other {color: #339999}.ace-vibrant-ink .ace_constant.ace_numeric {color: #99CC99}.ace-vibrant-ink .ace_invalid,.ace-vibrant-ink .ace_invalid.ace_deprecated {color: #CCFF33;background-color: #000000}.ace-vibrant-ink .ace_fold {background-color: #FFCC00;border-color: #FFFFFF}.ace-vibrant-ink .ace_entity.ace_name.ace_function,.ace-vibrant-ink .ace_support.ace_function,.ace-vibrant-ink .ace_variable {color: #FFCC00}.ace-vibrant-ink .ace_variable.ace_parameter {font-style: italic}.ace-vibrant-ink .ace_string {color: #66FF00}.ace-vibrant-ink .ace_string.ace_regexp {color: #44B4CC}.ace-vibrant-ink .ace_comment {color: #9933CC}.ace-vibrant-ink .ace_entity.ace_other.ace_attribute-name {font-style: italic;color: #99CC99}.ace-vibrant-ink .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYNDTc/oPAALPAZ7hxlbYAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/vibrant_ink"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/ace/theme-xcode.js: -------------------------------------------------------------------------------- 1 | define("ace/theme/xcode",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!1,t.cssClass="ace-xcode",t.cssText=".ace-xcode .ace_gutter {background: #e8e8e8;color: #333}.ace-xcode .ace_print-margin {width: 1px;background: #e8e8e8}.ace-xcode {background-color: #FFFFFF;color: #000000}.ace-xcode .ace_cursor {color: #000000}.ace-xcode .ace_marker-layer .ace_selection {background: #B5D5FF}.ace-xcode.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FFFFFF;}.ace-xcode .ace_marker-layer .ace_step {background: rgb(198, 219, 174)}.ace-xcode .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #BFBFBF}.ace-xcode .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.071)}.ace-xcode .ace_gutter-active-line {background-color: rgba(0, 0, 0, 0.071)}.ace-xcode .ace_marker-layer .ace_selected-word {border: 1px solid #B5D5FF}.ace-xcode .ace_constant.ace_language,.ace-xcode .ace_keyword,.ace-xcode .ace_meta,.ace-xcode .ace_variable.ace_language {color: #C800A4}.ace-xcode .ace_invisible {color: #BFBFBF}.ace-xcode .ace_constant.ace_character,.ace-xcode .ace_constant.ace_other {color: #275A5E}.ace-xcode .ace_constant.ace_numeric {color: #3A00DC}.ace-xcode .ace_entity.ace_other.ace_attribute-name,.ace-xcode .ace_support.ace_constant,.ace-xcode .ace_support.ace_function {color: #450084}.ace-xcode .ace_fold {background-color: #C800A4;border-color: #000000}.ace-xcode .ace_entity.ace_name.ace_tag,.ace-xcode .ace_support.ace_class,.ace-xcode .ace_support.ace_type {color: #790EAD}.ace-xcode .ace_storage {color: #C900A4}.ace-xcode .ace_string {color: #DF0002}.ace-xcode .ace_comment {color: #008E00}.ace-xcode .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { 2 | window.require(["ace/theme/xcode"], function(m) { 3 | if (typeof module == "object" && typeof exports == "object" && module) { 4 | module.exports = m; 5 | } 6 | }); 7 | })(); 8 | -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/pyodide/pyodide.asm.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/pyp5js/http_local/static/js/pyodide/pyodide.asm.data -------------------------------------------------------------------------------- /pyp5js/http_local/static/js/pyodide/pyodide.asm.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/pyp5js/http_local/static/js/pyodide/pyodide.asm.wasm -------------------------------------------------------------------------------- /pyp5js/http_local/static/styles/custom.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-family: sans-serif; 3 | } 4 | 5 | a { 6 | color: #07c; 7 | } 8 | 9 | .red { 10 | color: #d21; 11 | } 12 | 13 | .input { 14 | /* Color added due to .border of basscss force remove border color */ 15 | border-color: #ccc; 16 | } 17 | -------------------------------------------------------------------------------- /pyp5js/http_local/templates/base.html: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | pyp5js - {% block title %}{% endblock title %} 25 | 26 | 27 | 28 | 29 | {% block extra_head %} 30 | {% endblock extra_head %} 31 | 32 | 33 | 34 |
35 | {% block content %} 36 | {% endblock content %} 37 |
38 | 39 | 40 | {% block custom_js %} 41 | {% endblock custom_js %} 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /pyp5js/http_local/templates/index.html: -------------------------------------------------------------------------------- 1 | 18 | {% extends "base.html" %} 19 | {% block title %}Index{% endblock title %} 20 | 21 | {% block content %} 22 |

Welcome to your pyp5js sketchbook!

23 |

Add a new sketch

24 |

Available sketches in {{ sketches_dir }}:

25 | 30 | {% endblock content %} 31 | -------------------------------------------------------------------------------- /pyp5js/http_local/templates/new_sketch_form.html: -------------------------------------------------------------------------------- 1 | 18 | {% extends "base.html" %} 19 | {% block title %}New sketch{% endblock title %} 20 | 21 | {% block content %} 22 |
23 |

Start a new sketch

24 |

25 | Your sketch will be created in {{ sketches_dir }} 26 |

27 |
28 | {% if error %} 29 |

{{error}}

30 | {% endif %} 31 |
32 |
33 | 34 | 35 |
36 |
37 | 38 | 42 |
43 |
44 | 45 |
46 |
47 | {% endblock content %} 48 | -------------------------------------------------------------------------------- /pyp5js/http_local/templates/new_sketch_success.html: -------------------------------------------------------------------------------- 1 | 18 | {% extends "base.html" %} 19 | {% block title %}Success!{% endblock title %} 20 | 21 | {% block content %} 22 |

Your sketch was created with success!!!

23 |

Now you can start to draw, I mean, to code!

24 |

Edit your Python sketch file located at {{ files.sketch_py.resolve() }} and have fun!

25 |

Click here to see your results or go back to the home.

26 | {% endblock content %} 27 | -------------------------------------------------------------------------------- /pyp5js/monitor.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | import time 19 | from cprint import cprint 20 | from watchdog.events import PatternMatchingEventHandler 21 | from watchdog.observers import Observer 22 | 23 | from pyp5js.compiler import compile_sketch_js 24 | 25 | 26 | def monitor_sketch(sketch): 27 | observer = Observer() 28 | 29 | event_handler = TranscryptSketchEventHandler(sketch=sketch, observer=observer) 30 | 31 | observer.schedule(event_handler, str(sketch.sketch_dir.resolve())) 32 | observer.start() 33 | try: 34 | while True: 35 | time.sleep(1) 36 | except KeyboardInterrupt as e: 37 | observer.stop() 38 | raise e 39 | observer.join() 40 | 41 | 42 | class TranscryptSketchEventHandler(PatternMatchingEventHandler): 43 | patterns = ["*.py"] 44 | 45 | def __init__(self, *args, **kwargs): 46 | self.sketch = kwargs.pop('sketch') 47 | self.observer = kwargs.pop('observer') 48 | self._last_event = None 49 | super().__init__(*args, **kwargs) 50 | 51 | def on_modified(self, event): 52 | cprint.info(f"New change in {event.src_path}") 53 | 54 | # monkey patch on the observer handlers to avoid recursion 55 | handlers_config = self.observer._handlers.copy() 56 | handlers_copy = {} 57 | 58 | compile_sketch_js(self.sketch) 59 | 60 | queue = self.observer.event_queue 61 | while queue.qsize(): 62 | queue.get() 63 | 64 | index_file = self.sketch.index_html 65 | cprint.ok(f"Your sketch is ready and available at file://{index_file.absolute()}") 66 | -------------------------------------------------------------------------------- /pyp5js/templates/pyodide/base_sketch.py.template: -------------------------------------------------------------------------------- 1 | def setup(): 2 | createCanvas(200, 200) 3 | 4 | def draw(): 5 | background(200) 6 | diameter = sin(frameCount / 60) * 50 + 50 7 | fill("blue") 8 | ellipse(100, 100, diameter, diameter) 9 | -------------------------------------------------------------------------------- /pyp5js/templates/pyodide/index.html: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | {{ sketch_name }} - pyp5js (using pyodide) 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | 37 |
38 | 39 | 40 | -------------------------------------------------------------------------------- /pyp5js/templates/transcrypt/base_sketch.py.template: -------------------------------------------------------------------------------- 1 | def setup(): 2 | createCanvas(200, 200) 3 | 4 | def draw(): 5 | background(200) 6 | diameter = sin(frameCount / 60) * 50 + 50 7 | fill("blue") 8 | ellipse(100, 100, diameter, diameter) 9 | -------------------------------------------------------------------------------- /pyp5js/templates/transcrypt/index.html: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | {{ sketch_name }} - pyp5js 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
35 | 36 |
37 | 38 | 39 | -------------------------------------------------------------------------------- /pyp5js/templates/transcrypt/python_functions.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | class PythonFunctions: pass 19 | 20 | setattr(PythonFunctions, 'map', map) 21 | setattr(PythonFunctions, 'filter', filter) 22 | setattr(PythonFunctions, 'set', set) 23 | -------------------------------------------------------------------------------- /pyp5js/templates/transcrypt/target_sketch.py.template: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | from pyp5js import * 19 | 20 | def preload(): 21 | pass 22 | 23 | def setup(): 24 | pass 25 | 26 | def draw(): 27 | pass 28 | 29 | deviceMoved = None 30 | deviceTurned = None 31 | deviceShaken = None 32 | keyPressed = None 33 | keyReleased = None 34 | keyTyped = None 35 | mouseMoved = None 36 | mouseDragged = None 37 | mousePressed = None 38 | mouseReleased = None 39 | mouseClicked = None 40 | doubleClicked = None 41 | mouseWheel = None 42 | touchStarted = None 43 | touchMoved = None 44 | touchEnded = None 45 | windowResized = None 46 | keyIsDown = None 47 | 48 | 49 | {{ sketch_content }} 50 | 51 | 52 | event_functions = { 53 | "deviceMoved": deviceMoved, 54 | "deviceTurned": deviceTurned, 55 | "deviceShaken": deviceShaken, 56 | "keyPressed": keyPressed, 57 | "keyReleased": keyReleased, 58 | "keyTyped": keyTyped, 59 | "mouseMoved": mouseMoved, 60 | "mouseDragged": mouseDragged, 61 | "mousePressed": mousePressed, 62 | "mouseReleased": mouseReleased, 63 | "mouseClicked": mouseClicked, 64 | "doubleClicked": doubleClicked, 65 | "mouseWheel": mouseWheel, 66 | "touchStarted": touchStarted, 67 | "touchMoved": touchMoved, 68 | "touchEnded": touchEnded, 69 | "windowResized": windowResized, 70 | "keyIsDown": keyIsDown, 71 | } 72 | 73 | start_p5(preload, setup, draw, event_functions) 74 | -------------------------------------------------------------------------------- /pyp5js/templates_renderers.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | from jinja2 import Environment, FileSystemLoader, select_autoescape 19 | 20 | from pyp5js.config.fs import PYP5JS_FILES 21 | from pyp5js.sketch import Sketch 22 | 23 | templates = Environment(loader=FileSystemLoader(str(PYP5JS_FILES.templates_dir))) 24 | 25 | 26 | def _template_from_file(filename, context): 27 | templates = Environment(loader=FileSystemLoader(str(filename.parent.resolve()))) 28 | template = templates.get_template(filename.name) 29 | return template.render(context) 30 | 31 | 32 | def get_sketch_index_content(sketch): 33 | """ 34 | Renders SKETCH_NAME/index.html to display the sketch visualization. 35 | template can be a pathlib.Path object with a specified custom template path 36 | """ 37 | context = { 38 | "sketch_name": sketch.sketch_name, 39 | "p5_js_url": sketch.urls.p5_js_url, 40 | "pyodide_js_url": sketch.urls.pyodide_js_url, 41 | "sketch_js_url": sketch.urls.sketch_js_url, 42 | "sketch_content": sketch.sketch_content, 43 | } 44 | template_file = sketch.config.get_index_template() 45 | return _template_from_file(template_file, context) 46 | 47 | 48 | def get_target_sketch_content(sketch): 49 | """ 50 | Renders the content to be written in the temporary SKETCH_NAME/target_sketch.py file 51 | """ 52 | context = sketch.get_target_sketch_context() 53 | target_js_file = sketch.config.get_target_js_template() 54 | return _template_from_file(target_js_file, context) 55 | -------------------------------------------------------------------------------- /pyp5js/tests/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | -------------------------------------------------------------------------------- /pyp5js/tests/test_config/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | -------------------------------------------------------------------------------- /pyp5js/tests/test_http/assets/alien.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berinhard/pyp5js/87ebb8e48ebabfd4e0281693fffa6ba9fb61d19e/pyp5js/tests/test_http/assets/alien.png -------------------------------------------------------------------------------- /pyp5js/tests/test_monitor.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | from queue import Queue 19 | from unittest import TestCase 20 | from unittest.mock import Mock, patch 21 | 22 | from pyp5js.monitor import TranscryptSketchEventHandler 23 | from pyp5js.sketch import Sketch 24 | 25 | 26 | class TranscryptSketchEventHandlerTests(TestCase): 27 | 28 | def setUp(self): 29 | self.files = Mock(spec=Sketch) 30 | self.queue = Mock(spec=Queue) 31 | self.observer = Mock(event_queue=self.queue) 32 | self.handler = TranscryptSketchEventHandler(sketch=self.files, observer=self.observer) 33 | 34 | def test_handler_config(self): 35 | assert self.files == self.handler.sketch 36 | assert ['*.py'] == self.handler.patterns 37 | assert self.observer == self.handler.observer 38 | 39 | @patch('pyp5js.monitor.compile_sketch_js') 40 | def test_on_modified(self, mocked_compiler): 41 | self.queue.qsize.return_value = 0 42 | event = Mock() 43 | 44 | self.handler.on_modified(event) 45 | 46 | mocked_compiler.assert_called_once_with(self.files) 47 | self.queue.qsize.assert_called_once_with() 48 | 49 | @patch('pyp5js.monitor.compile_sketch_js') 50 | def test_on_modified_cleans_event_queue_from_changes_introduced_by_pyp5(self, mocked_compiler): 51 | self.queue.qsize.side_effect = sorted(range(11), reverse=True) 52 | event = Mock() 53 | 54 | self.handler.on_modified(event) 55 | 56 | mocked_compiler.assert_called_once_with(self.files) 57 | assert self.queue.qsize.call_count == 11 58 | assert 10 == self.queue.get.call_count 59 | -------------------------------------------------------------------------------- /pyp5js/tests/test_pyp5js.py: -------------------------------------------------------------------------------- 1 | """ 2 | pyp5js 3 | Copyright (C) 2019-2021 Bernardo Fontes 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | """ 18 | """ 19 | Test file to guarantee the Python code that'll be translated to JS 20 | """ 21 | from pyaml import yaml 22 | import pytest 23 | 24 | from pyp5js.config.fs import PYP5JS_FILES 25 | 26 | 27 | @pytest.fixture 28 | def pyp5js(): 29 | with PYP5JS_FILES.pytop5js.open('r') as fd: 30 | return fd.read() 31 | 32 | 33 | @pytest.fixture 34 | def p5_reference(): 35 | with PYP5JS_FILES.p5_yml.open('r') as fd: 36 | return yaml.safe_load(fd) 37 | 38 | 39 | special_methods = ['pop', 'clear', 'get'] 40 | 41 | 42 | def test_all_regular_p5_methods_are_defined(pyp5js, p5_reference): 43 | for method in [m for m in p5_reference['p5']['methods'] if m not in special_methods]: 44 | if method == 'loadImage': 45 | continue 46 | assert f"def {method}(*args):" in pyp5js 47 | assert f" return _P5_INSTANCE.{method}(*args)" in pyp5js 48 | 49 | assert f"def loadImage(*args):" in pyp5js 50 | assert f" imageObj = _P5_INSTANCE.loadImage(*args)" in pyp5js 51 | assert f" return image_proxy(imageObj)" in pyp5js 52 | 53 | for method in [m for m in p5_reference['dom']['methods'] if m not in special_methods]: 54 | assert f"def {method}(*args):" in pyp5js 55 | assert f" return _P5_INSTANCE.{method}(*args)" in pyp5js 56 | 57 | 58 | def test_all_special_methods(pyp5js, p5_reference): 59 | for method in special_methods: 60 | assert f"def {method}(*args):" in pyp5js 61 | assert f" __pragma__('noalias', '{method}')" in pyp5js 62 | assert f" p5_{method} = _P5_INSTANCE.{method}(*args)" in pyp5js 63 | assert f" __pragma__('alias', '{method}', 'py_{method}')" in pyp5js 64 | assert f" return p5_{method}" in pyp5js 65 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | env = 3 | SKETCHBOOK_DIR=tests-sketchbook 4 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Click==8.0.1 2 | Jinja2==3.1.2 3 | Transcrypt==3.9.0 4 | cprint==1.2.2 5 | gunicorn==20.1.0 6 | watchdog==2.1.9 7 | python-decouple==3.6 8 | Flask==2.2.2 9 | python-slugify==6.1.2 10 | markupsafe==2.1.1 11 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2019 Bernardo Fontes 2 | 3 | # This program is free software: you can redistribute it and/or modify 4 | # it under the terms of the GNU Lesser General Public License as published by 5 | # the Free Software Foundation, either version 3 of the License, or 6 | # (at your option) any later version. 7 | 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Lesser General Public License for more details. 12 | 13 | # You should have received a copy of the GNU Lesser General Public License 14 | # along with this program. If not, see . 15 | 16 | from setuptools import setup, find_packages 17 | 18 | with open("requirements.txt") as fd: 19 | requirements = [l.strip() for l in fd.readlines()] 20 | 21 | with open("README.md") as fd: 22 | long_description = fd.read() 23 | 24 | with open("VERSION") as fd: 25 | version = fd.read().strip() 26 | 27 | setup( 28 | name="pyp5js", 29 | version=version, 30 | description='Simple tool to allow to transcrypt Python code that uses P5.js', 31 | long_description=long_description, 32 | long_description_content_type='text/markdown', 33 | author='Bernardo Fontes', 34 | maintainer='Bernardo Fontes', 35 | maintainer_email='bernardoxhc@gmail.com', 36 | url="https://github.com/berinhard/pyp5js/", 37 | license='GNU Lesser General Public License version 3', 38 | packages=find_packages(exclude=["pyp5js.tests"]), 39 | package_data={ 40 | 'pyp5js': [ 41 | 'templates/*', 42 | 'http_local/templates/*', 43 | 'http_local/static/*', 44 | ] 45 | }, 46 | include_package_data=True, 47 | zip_safe=False, 48 | entry_points={ 49 | 'console_scripts': ['pyp5js = pyp5js.cli:command_line_entrypoint'] 50 | }, 51 | python_requires='>=3.6', 52 | install_requires=requirements, 53 | keywords="p5js processing creative coding", 54 | ) 55 | --------------------------------------------------------------------------------