diff --git a/CHANGELOG.md b/CHANGELOG.md index 707245a3..4bd879ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Development ----------- +0.7.0 +----- +- Remove `from pyp5js import *` requirement under transcrypt [PR #183](https://github.com/berinhard/pyp5js/pull/183/) +- Make local code editor collapsible [PR #184](https://github.com/berinhard/pyp5js/pull/184/) +- Add `mouseWheel` event to Pyodide's demo [PR #185](https://github.com/berinhard/pyp5js/pull/185/) + 0.6.0 ----- - Add transcrypt interpreter choice to web editor [PR #175](https://github.com/berinhard/pyp5js/pull/175) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..2d78114f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,37 @@ +## Contributing to pyp5js + +Here you'll find all possible ways to contribute to the project. + +### Testing, testing and testing + +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. + +### What about these shinning examples? + +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. + +### I want to hack! + +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: + +``` +$ git clone git@github.com:YOUR_GITHUB_PROFILE/pyp5js.git +$ cd pyp5js +$ pip install -r dev-requirements.txt +$ python setup.py develop +$ make test +``` + +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: + +- `config` module: centralize pieces of code used to configure how `pyp5js` runs +- `cli.py`: the entrypoint for `pyp5js` commands such as `new` or `compile` +- `commands.py`: just functions responsible for the real implementations for `pyp5js` commands +- `compiler.py`: where all the magic happens! +- `exception.py`: custom exceptions used by `pyp5js` +- `monitor.py`: module with the objects used by the `monitor` command +- `sketch.py`: class to abstract Sketches' files, directories and configuration +- `template_renderers.py`: simple module with the renderization logic for the code templates like `target_sketch.py` +- `http/web_app.py`: Flask application for the web interface. + +Now go [fetch yourself an issue](https://github.com/berinhard/pyp5js/issues) and happy hacking! diff --git a/Makefile b/Makefile index 76bd9387..c5853252 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,10 @@ upload_pypi: # helper command for the maintainer to refresh the docs files refresh_transcrypt_docs: - cd docs/examples/transcrypt; for x in `ls -d */`; do SKETCHBOOK_DIR="/home/bernardo/envs/pyp5js/docs/examples/transcrypt" pyp5js compile $$x --refresh; done; + 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; refresh_pyodide_docs: - cd docs/examples/pyodide; for x in `ls -d */`; do SKETCHBOOK_DIR="/home/bernardo/envs/pyp5js/docs/examples/pyodide" pyp5js compile $$x --refresh; done; + 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; + +refresh_demo: + SKETCHBOOK_DIR="/home/bernardo/envs/pyp5js/docs/" pyp5js compile pyodide --refresh --template "/home/bernardo/envs/pyp5js/docs/pyodide/index.html.template"; diff --git a/VERSION b/VERSION index a918a2aa..faef31a4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.0 +0.7.0 diff --git a/dev-requirements.txt b/dev-requirements.txt index dc662cae..3313f30b 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -8,3 +8,5 @@ pytest-env==0.6.2 Flask-Testing==0.8.0 blinker==1.4 pyaml==20.4.0 +wheel==0.37.0 +twine==3.4.2 diff --git a/docs/examples/transcrypt/sketch_001/index.html b/docs/examples/transcrypt/sketch_001/index.html index e50d79d9..82415809 100644 --- a/docs/examples/transcrypt/sketch_001/index.html +++ b/docs/examples/transcrypt/sketch_001/index.html @@ -49,9 +49,6 @@ # https://p5js.org/examples/interaction-wavemaker.html - -from pyp5js import * - t = 0 def setup(): diff --git a/docs/examples/transcrypt/sketch_001/sketch_001.py b/docs/examples/transcrypt/sketch_001/sketch_001.py index 358ce99e..1bd2af2a 100644 --- a/docs/examples/transcrypt/sketch_001/sketch_001.py +++ b/docs/examples/transcrypt/sketch_001/sketch_001.py @@ -1,8 +1,5 @@ # https://p5js.org/examples/interaction-wavemaker.html - -from pyp5js import * - t = 0 def setup(): diff --git a/docs/examples/transcrypt/sketch_001/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_001/target/org.transcrypt.__runtime__.js index 08ab5a87..c53ac13e 100644 --- a/docs/examples/transcrypt/sketch_001/target/org.transcrypt.__runtime__.js +++ b/docs/examples/transcrypt/sketch_001/target/org.transcrypt.__runtime__.js @@ -1,10 +1,10 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:30 +// Transcrypt'ed from Python, 2021-10-14 12:26:15 var __name__ = 'org.transcrypt.__runtime__'; export var __envir__ = {}; __envir__.interpreter_name = 'python'; __envir__.transpiler_name = 'transcrypt'; __envir__.executor_name = __envir__.transpiler_name; -__envir__.transpiler_version = '3.7.16'; +__envir__.transpiler_version = '3.9.0'; export function __nest__ (headObject, tailNames, value) { var current = headObject; @@ -38,15 +38,14 @@ export function __init__ (module) { } return module.__all__; }; -export var __proxy__ = false; -export function __get__ (self, func, quotedFuncName) { - if (self) { - if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) { +export function __get__ (aThis, func, quotedFuncName) { + if (aThis) { + if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) { if (quotedFuncName) { - Object.defineProperty (self, quotedFuncName, { + Object.defineProperty (aThis, quotedFuncName, { value: function () { var args = [] .slice.apply (arguments); - return func.apply (null, [self] .concat (args)); + return func.apply (null, [aThis] .concat (args)); }, writable: true, enumerable: true, @@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) { } return function () { var args = [] .slice.apply (arguments); - return func.apply (null, [self] .concat (args)); + return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args)); }; } else { @@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) { return func; } }; -export function __getcm__ (self, func, quotedFuncName) { - if (self.hasOwnProperty ('__class__')) { +export function __getcm__ (aThis, func, quotedFuncName) { + if (aThis.hasOwnProperty ('__class__')) { return function () { var args = [] .slice.apply (arguments); - return func.apply (null, [self.__class__] .concat (args)); + return func.apply (null, [aThis.__class__] .concat (args)); }; } else { return function () { var args = [] .slice.apply (arguments); - return func.apply (null, [self] .concat (args)); + return func.apply (null, [aThis] .concat (args)); }; } }; -export function __getsm__ (self, func, quotedFuncName) { +export function __getsm__ (aThis, func, quotedFuncName) { return func; }; export var py_metatype = { @@ -95,6 +94,9 @@ export var py_metatype = { var base = bases [index]; for (var attrib in base) { var descrip = Object.getOwnPropertyDescriptor (base, attrib); + if (descrip == null) { + continue; + } Object.defineProperty (cls, attrib, descrip); } for (let symbol of Object.getOwnPropertySymbols (base)) { @@ -125,7 +127,7 @@ export var object = { __new__: function (args) { var instance = Object.create (this, {__class__: {value: this, enumerable: true}}); if ('__getattr__' in this || '__setattr__' in this) { - instance = new Proxy (instance, { + instance.__proxy__ = new Proxy (instance, { get: function (target, name) { let result = target [name]; if (result == undefined) { @@ -145,6 +147,7 @@ export var object = { return true; } }) + instance = instance.__proxy__ } this.__init__.apply (null, [instance] .concat (args)); return instance; @@ -1830,10 +1833,13 @@ export var Exception = __class__ ('Exception', [BaseException], { var args = tuple (); } self.__args__ = args; - try { + if (kwargs.error != null) { self.stack = kwargs.error.stack; } - catch (__except0__) { + else if (Error) { + self.stack = new Error ().stack; + } + else { self.stack = 'No stack trace available'; } });}, diff --git a/docs/examples/transcrypt/sketch_001/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_001/target/org.transcrypt.__runtime__.py index 87834491..8b06f7ba 100644 --- a/docs/examples/transcrypt/sketch_001/target/org.transcrypt.__runtime__.py +++ b/docs/examples/transcrypt/sketch_001/target/org.transcrypt.__runtime__.py @@ -19,9 +19,11 @@ class Exception (BaseException): #__pragma__ ('kwargs') def __init__ (self, *args, **kwargs): self.__args__ = args - try: + if kwargs.error != None: self.stack = kwargs.error.stack # Integrate with JavaScript Error object - except: + elif Error: + self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one + else: self.stack = 'No stack trace available' #__pragma__ ('nokwargs') diff --git a/docs/examples/transcrypt/sketch_001/target/pyp5js.js b/docs/examples/transcrypt/sketch_001/target/pyp5js.js index b21444ee..a43f6c85 100644 --- a/docs/examples/transcrypt/sketch_001/target/pyp5js.js +++ b/docs/examples/transcrypt/sketch_001/target/pyp5js.js @@ -1,5 +1,5 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:30 -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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; +// Transcrypt'ed from Python, 2021-10-14 12:26:15 +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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; import {PythonFunctions} from './python_functions.js'; var __name__ = 'pyp5js'; export var _P5_INSTANCE = null; diff --git a/docs/examples/transcrypt/sketch_001/target/python_functions.js b/docs/examples/transcrypt/sketch_001/target/python_functions.js index 037d1e86..afb92d4e 100644 --- a/docs/examples/transcrypt/sketch_001/target/python_functions.js +++ b/docs/examples/transcrypt/sketch_001/target/python_functions.js @@ -1,5 +1,5 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:31 -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'; +// Transcrypt'ed from Python, 2021-10-14 12:26:16 +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'; var __name__ = 'python_functions'; export var PythonFunctions = __class__ ('PythonFunctions', [object], { __module__: __name__, diff --git a/docs/examples/transcrypt/sketch_001/target/sketch_001.js b/docs/examples/transcrypt/sketch_001/target/sketch_001.js deleted file mode 100644 index c8c9ab1a..00000000 --- a/docs/examples/transcrypt/sketch_001/target/sketch_001.js +++ /dev/null @@ -1,47 +0,0 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:31 -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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; -import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js'; -var __name__ = 'sketch_001'; -export var t = 0; -export var setup = function () { - if (arguments.length) { - var __ilastarg0__ = arguments.length - 1; - if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { - var __allkwargs0__ = arguments [__ilastarg0__--]; - for (var __attrib0__ in __allkwargs0__) { - } - } - } - else { - } - createCanvas (600, 600); - stroke (250); - strokeWeight (3); - fill (40, 200, 40); -}; -export var draw = function () { - if (arguments.length) { - var __ilastarg0__ = arguments.length - 1; - if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { - var __allkwargs0__ = arguments [__ilastarg0__--]; - for (var __attrib0__ in __allkwargs0__) { - } - } - } - else { - } - background (10, 10); - var xAngle = map (mouseX, 0, width, -(4) * PI, 4 * PI, true); - var yAngle = map (mouseY, 0, height, -(4) * PI, 4 * PI, true); - for (var x of range (0, width, 30)) { - for (var y of range (0, height, 30)) { - var angle = xAngle * (x / width) + yAngle * (y / height); - var myX = x + 20 * cos ((2 * PI) * t + angle); - var myY = y + 20 * sin ((2 * TWO_PI) * t + angle); - ellipse (myX, myY, 10); - } - } - t = t + 0.01; -}; - -//# sourceMappingURL=sketch_001.map \ No newline at end of file diff --git a/docs/examples/transcrypt/sketch_001/target/sketch_001.py b/docs/examples/transcrypt/sketch_001/target/sketch_001.py deleted file mode 100644 index 358ce99e..00000000 --- a/docs/examples/transcrypt/sketch_001/target/sketch_001.py +++ /dev/null @@ -1,31 +0,0 @@ -# https://p5js.org/examples/interaction-wavemaker.html - - -from pyp5js import * - -t = 0 - -def setup(): - createCanvas(600, 600) - stroke(250) - strokeWeight(3) - fill(40, 200, 40) - - -def draw(): - global t - background(10, 10) - - xAngle = map(mouseX, 0, width, -4 * PI, 4 * PI, True) - yAngle = map(mouseY, 0, height, -4 * PI, 4 * PI, True) - for x in range(0, width, 30): - for y in range(0, height, 30): - - angle = xAngle * (x / width) + yAngle * (y / height) - - myX = x + 20 * cos(2 * PI * t + angle) - myY = y + 20 * sin(2 * TWO_PI * t + angle) - - ellipse(myX, myY, 10) - - t = t + 0.01 diff --git a/docs/examples/transcrypt/sketch_001/target/target_sketch.js b/docs/examples/transcrypt/sketch_001/target/target_sketch.js index 5c610571..f125c40d 100644 --- a/docs/examples/transcrypt/sketch_001/target/target_sketch.js +++ b/docs/examples/transcrypt/sketch_001/target/target_sketch.js @@ -1,9 +1,92 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:30 -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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; -import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js'; -import * as source_sketch from './sketch_001.js'; +// Transcrypt'ed from Python, 2021-10-14 12:26:15 +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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; +import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js'; var __name__ = '__main__'; -export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]); -start_p5 (source_sketch.setup, source_sketch.draw, event_functions); +export var setup = function () { + if (arguments.length) { + var __ilastarg0__ = arguments.length - 1; + if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { + var __allkwargs0__ = arguments [__ilastarg0__--]; + for (var __attrib0__ in __allkwargs0__) { + } + } + } + else { + } + // pass; +}; +export var draw = function () { + if (arguments.length) { + var __ilastarg0__ = arguments.length - 1; + if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { + var __allkwargs0__ = arguments [__ilastarg0__--]; + for (var __attrib0__ in __allkwargs0__) { + } + } + } + else { + } + // pass; +}; +export var deviceMoved = null; +export var deviceTurned = null; +export var deviceShaken = null; +export var keyPressed = null; +export var keyReleased = null; +export var keyTyped = null; +export var mouseMoved = null; +export var mouseDragged = null; +export var mousePressed = null; +export var mouseReleased = null; +export var mouseClicked = null; +export var doubleClicked = null; +export var mouseWheel = null; +export var touchStarted = null; +export var touchMoved = null; +export var touchEnded = null; +export var windowResized = null; +export var t = 0; +var setup = function () { + if (arguments.length) { + var __ilastarg0__ = arguments.length - 1; + if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { + var __allkwargs0__ = arguments [__ilastarg0__--]; + for (var __attrib0__ in __allkwargs0__) { + } + } + } + else { + } + createCanvas (600, 600); + stroke (250); + strokeWeight (3); + fill (40, 200, 40); +}; +var draw = function () { + if (arguments.length) { + var __ilastarg0__ = arguments.length - 1; + if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { + var __allkwargs0__ = arguments [__ilastarg0__--]; + for (var __attrib0__ in __allkwargs0__) { + } + } + } + else { + } + background (10, 10); + var xAngle = map (mouseX, 0, width, -(4) * PI, 4 * PI, true); + var yAngle = map (mouseY, 0, height, -(4) * PI, 4 * PI, true); + for (var x = 0; x < width; x += 30) { + for (var y = 0; y < height; y += 30) { + var angle = xAngle * (x / width) + yAngle * (y / height); + var myX = x + 20 * cos ((2 * PI) * t + angle); + var myY = y + 20 * sin ((2 * TWO_PI) * t + angle); + ellipse (myX, myY, 10); + } + } + t = t + 0.01; +}; +export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized}); +start_p5 (setup, draw, event_functions); //# sourceMappingURL=target_sketch.map \ No newline at end of file diff --git a/docs/examples/transcrypt/sketch_001/target/target_sketch.project b/docs/examples/transcrypt/sketch_001/target/target_sketch.project index cfcc0fea..d220959f 100644 --- a/docs/examples/transcrypt/sketch_001/target/target_sketch.project +++ b/docs/examples/transcrypt/sketch_001/target/target_sketch.project @@ -1 +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, "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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_001/sketch_001.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_001/__target__/sketch_001.js"}]} \ No newline at end of file +{"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.9/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"}]} \ No newline at end of file diff --git a/docs/examples/transcrypt/sketch_001/target/target_sketch.py b/docs/examples/transcrypt/sketch_001/target/target_sketch.py index 537b3fa4..99e9dc24 100644 --- a/docs/examples/transcrypt/sketch_001/target/target_sketch.py +++ b/docs/examples/transcrypt/sketch_001/target/target_sketch.py @@ -1,24 +1,79 @@ -import sketch_001 as source_sketch from pyp5js import * +def setup(): + pass + +def draw(): + pass + +deviceMoved = None +deviceTurned = None +deviceShaken = None +keyPressed = None +keyReleased = None +keyTyped = None +mouseMoved = None +mouseDragged = None +mousePressed = None +mouseReleased = None +mouseClicked = None +doubleClicked = None +mouseWheel = None +touchStarted = None +touchMoved = None +touchEnded = None +windowResized = None + + +# https://p5js.org/examples/interaction-wavemaker.html + +t = 0 + +def setup(): + createCanvas(600, 600) + stroke(250) + strokeWeight(3) + fill(40, 200, 40) + + +def draw(): + global t + background(10, 10) + + xAngle = map(mouseX, 0, width, -4 * PI, 4 * PI, True) + yAngle = map(mouseY, 0, height, -4 * PI, 4 * PI, True) + for x in range(0, width, 30): + for y in range(0, height, 30): + + angle = xAngle * (x / width) + yAngle * (y / height) + + myX = x + 20 * cos(2 * PI * t + angle) + myY = y + 20 * sin(2 * TWO_PI * t + angle) + + ellipse(myX, myY, 10) + + t = t + 0.01 + + + event_functions = { - "deviceMoved": source_sketch.deviceMoved, - "deviceTurned": source_sketch.deviceTurned, - "deviceShaken": source_sketch.deviceShaken, - "keyPressed": source_sketch.keyPressed, - "keyReleased": source_sketch.keyReleased, - "keyTyped": source_sketch.keyTyped, - "mouseMoved": source_sketch.mouseMoved, - "mouseDragged": source_sketch.mouseDragged, - "mousePressed": source_sketch.mousePressed, - "mouseReleased": source_sketch.mouseReleased, - "mouseClicked": source_sketch.mouseClicked, - "doubleClicked": source_sketch.doubleClicked, - "mouseWheel": source_sketch.mouseWheel, - "touchStarted": source_sketch.touchStarted, - "touchMoved": source_sketch.touchMoved, - "touchEnded": source_sketch.touchEnded, - "windowResized": source_sketch.windowResized, + "deviceMoved": deviceMoved, + "deviceTurned": deviceTurned, + "deviceShaken": deviceShaken, + "keyPressed": keyPressed, + "keyReleased": keyReleased, + "keyTyped": keyTyped, + "mouseMoved": mouseMoved, + "mouseDragged": mouseDragged, + "mousePressed": mousePressed, + "mouseReleased": mouseReleased, + "mouseClicked": mouseClicked, + "doubleClicked": doubleClicked, + "mouseWheel": mouseWheel, + "touchStarted": touchStarted, + "touchMoved": touchMoved, + "touchEnded": touchEnded, + "windowResized": windowResized, } -start_p5(source_sketch.setup, source_sketch.draw, event_functions) \ No newline at end of file +start_p5(setup, draw, event_functions) \ No newline at end of file diff --git a/docs/examples/transcrypt/sketch_002/index.html b/docs/examples/transcrypt/sketch_002/index.html index d3ccbe95..39a859f5 100644 --- a/docs/examples/transcrypt/sketch_002/index.html +++ b/docs/examples/transcrypt/sketch_002/index.html @@ -53,7 +53,6 @@ * * The camera lifts up (controlled by mouseY) while looking at the same point. """ -from pyp5js import * def setup(): createCanvas(640, 360, _P5_INSTANCE.WEBGL) diff --git a/docs/examples/transcrypt/sketch_002/sketch_002.py b/docs/examples/transcrypt/sketch_002/sketch_002.py index a95b031a..4313f4b5 100644 --- a/docs/examples/transcrypt/sketch_002/sketch_002.py +++ b/docs/examples/transcrypt/sketch_002/sketch_002.py @@ -4,7 +4,6 @@ * * The camera lifts up (controlled by mouseY) while looking at the same point. """ -from pyp5js import * def setup(): createCanvas(640, 360, _P5_INSTANCE.WEBGL) diff --git a/docs/examples/transcrypt/sketch_002/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_002/target/org.transcrypt.__runtime__.js index 3153e1a3..eaae7387 100644 --- a/docs/examples/transcrypt/sketch_002/target/org.transcrypt.__runtime__.js +++ b/docs/examples/transcrypt/sketch_002/target/org.transcrypt.__runtime__.js @@ -1,10 +1,10 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:31 +// Transcrypt'ed from Python, 2021-10-14 12:26:16 var __name__ = 'org.transcrypt.__runtime__'; export var __envir__ = {}; __envir__.interpreter_name = 'python'; __envir__.transpiler_name = 'transcrypt'; __envir__.executor_name = __envir__.transpiler_name; -__envir__.transpiler_version = '3.7.16'; +__envir__.transpiler_version = '3.9.0'; export function __nest__ (headObject, tailNames, value) { var current = headObject; @@ -38,15 +38,14 @@ export function __init__ (module) { } return module.__all__; }; -export var __proxy__ = false; -export function __get__ (self, func, quotedFuncName) { - if (self) { - if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) { +export function __get__ (aThis, func, quotedFuncName) { + if (aThis) { + if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) { if (quotedFuncName) { - Object.defineProperty (self, quotedFuncName, { + Object.defineProperty (aThis, quotedFuncName, { value: function () { var args = [] .slice.apply (arguments); - return func.apply (null, [self] .concat (args)); + return func.apply (null, [aThis] .concat (args)); }, writable: true, enumerable: true, @@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) { } return function () { var args = [] .slice.apply (arguments); - return func.apply (null, [self] .concat (args)); + return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args)); }; } else { @@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) { return func; } }; -export function __getcm__ (self, func, quotedFuncName) { - if (self.hasOwnProperty ('__class__')) { +export function __getcm__ (aThis, func, quotedFuncName) { + if (aThis.hasOwnProperty ('__class__')) { return function () { var args = [] .slice.apply (arguments); - return func.apply (null, [self.__class__] .concat (args)); + return func.apply (null, [aThis.__class__] .concat (args)); }; } else { return function () { var args = [] .slice.apply (arguments); - return func.apply (null, [self] .concat (args)); + return func.apply (null, [aThis] .concat (args)); }; } }; -export function __getsm__ (self, func, quotedFuncName) { +export function __getsm__ (aThis, func, quotedFuncName) { return func; }; export var py_metatype = { @@ -95,6 +94,9 @@ export var py_metatype = { var base = bases [index]; for (var attrib in base) { var descrip = Object.getOwnPropertyDescriptor (base, attrib); + if (descrip == null) { + continue; + } Object.defineProperty (cls, attrib, descrip); } for (let symbol of Object.getOwnPropertySymbols (base)) { @@ -125,7 +127,7 @@ export var object = { __new__: function (args) { var instance = Object.create (this, {__class__: {value: this, enumerable: true}}); if ('__getattr__' in this || '__setattr__' in this) { - instance = new Proxy (instance, { + instance.__proxy__ = new Proxy (instance, { get: function (target, name) { let result = target [name]; if (result == undefined) { @@ -145,6 +147,7 @@ export var object = { return true; } }) + instance = instance.__proxy__ } this.__init__.apply (null, [instance] .concat (args)); return instance; @@ -1830,10 +1833,13 @@ export var Exception = __class__ ('Exception', [BaseException], { var args = tuple (); } self.__args__ = args; - try { + if (kwargs.error != null) { self.stack = kwargs.error.stack; } - catch (__except0__) { + else if (Error) { + self.stack = new Error ().stack; + } + else { self.stack = 'No stack trace available'; } });}, diff --git a/docs/examples/transcrypt/sketch_002/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_002/target/org.transcrypt.__runtime__.py index 87834491..8b06f7ba 100644 --- a/docs/examples/transcrypt/sketch_002/target/org.transcrypt.__runtime__.py +++ b/docs/examples/transcrypt/sketch_002/target/org.transcrypt.__runtime__.py @@ -19,9 +19,11 @@ class Exception (BaseException): #__pragma__ ('kwargs') def __init__ (self, *args, **kwargs): self.__args__ = args - try: + if kwargs.error != None: self.stack = kwargs.error.stack # Integrate with JavaScript Error object - except: + elif Error: + self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one + else: self.stack = 'No stack trace available' #__pragma__ ('nokwargs') diff --git a/docs/examples/transcrypt/sketch_002/target/pyp5js.js b/docs/examples/transcrypt/sketch_002/target/pyp5js.js index 93a5ce00..c74a00f5 100644 --- a/docs/examples/transcrypt/sketch_002/target/pyp5js.js +++ b/docs/examples/transcrypt/sketch_002/target/pyp5js.js @@ -1,5 +1,5 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:31 -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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; +// Transcrypt'ed from Python, 2021-10-14 12:26:17 +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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; import {PythonFunctions} from './python_functions.js'; var __name__ = 'pyp5js'; export var _P5_INSTANCE = null; diff --git a/docs/examples/transcrypt/sketch_002/target/python_functions.js b/docs/examples/transcrypt/sketch_002/target/python_functions.js index abaffe38..b1cce4f4 100644 --- a/docs/examples/transcrypt/sketch_002/target/python_functions.js +++ b/docs/examples/transcrypt/sketch_002/target/python_functions.js @@ -1,5 +1,5 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:32 -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'; +// Transcrypt'ed from Python, 2021-10-14 12:26:17 +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'; var __name__ = 'python_functions'; export var PythonFunctions = __class__ ('PythonFunctions', [object], { __module__: __name__, diff --git a/docs/examples/transcrypt/sketch_002/target/sketch_002.js b/docs/examples/transcrypt/sketch_002/target/sketch_002.js deleted file mode 100644 index 322c5e89..00000000 --- a/docs/examples/transcrypt/sketch_002/target/sketch_002.js +++ /dev/null @@ -1,42 +0,0 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:32 -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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; -import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js'; -var __name__ = 'sketch_002'; -export var setup = function () { - if (arguments.length) { - var __ilastarg0__ = arguments.length - 1; - if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { - var __allkwargs0__ = arguments [__ilastarg0__--]; - for (var __attrib0__ in __allkwargs0__) { - } - } - } - else { - } - createCanvas (640, 360, _P5_INSTANCE.WEBGL); - fill (204); -}; -export var draw = function () { - if (arguments.length) { - var __ilastarg0__ = arguments.length - 1; - if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { - var __allkwargs0__ = arguments [__ilastarg0__--]; - for (var __attrib0__ in __allkwargs0__) { - } - } - } - else { - } - ambientLight (50); - directionalLight (255, 0, 0, 0.25, 0.25, 0); - background (0); - camera (30.0, mouseY, 220.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); - noStroke (); - box (90); - stroke (255); - line (-(100), 0, 0, 100, 0, 0); - line (0, -(100), 0, 0, 100, 0); - line (0, 0, -(100), 0, 0, 100); -}; - -//# sourceMappingURL=sketch_002.map \ No newline at end of file diff --git a/docs/examples/transcrypt/sketch_002/target/sketch_002.py b/docs/examples/transcrypt/sketch_002/target/sketch_002.py deleted file mode 100644 index a95b031a..00000000 --- a/docs/examples/transcrypt/sketch_002/target/sketch_002.py +++ /dev/null @@ -1,29 +0,0 @@ -""" - * Move Eye. - * by Simon Greenwold. - * - * The camera lifts up (controlled by mouseY) while looking at the same point. - """ -from pyp5js import * - -def setup(): - createCanvas(640, 360, _P5_INSTANCE.WEBGL) - fill(204) - - -def draw(): - ambientLight(50) - directionalLight(255, 0, 0, 0.25, 0.25, 0); - background(0) - - # Change height of the camera with mouseY - camera(30.0, mouseY, 220.0, # eyeX, eyeY, eyeZ - 0.0, 0.0, 0.0, # centerX, centerY, centerZ - 0.0, 1.0, 0.0) # upX, upY, upZ - - noStroke() - box(90) - stroke(255) - line(-100, 0, 0, 100, 0, 0) - line(0, -100, 0, 0, 100, 0) - line(0, 0, -100, 0, 0, 100) diff --git a/docs/examples/transcrypt/sketch_002/target/target_sketch.js b/docs/examples/transcrypt/sketch_002/target/target_sketch.js index f9f70d67..c9a387f3 100644 --- a/docs/examples/transcrypt/sketch_002/target/target_sketch.js +++ b/docs/examples/transcrypt/sketch_002/target/target_sketch.js @@ -1,9 +1,87 @@ -// Transcrypt'ed from Python, 2021-09-20 17:40:31 -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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; -import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js'; -import * as source_sketch from './sketch_002.js'; +// Transcrypt'ed from Python, 2021-10-14 12:26:17 +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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js'; +import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js'; var __name__ = '__main__'; -export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]); -start_p5 (source_sketch.setup, source_sketch.draw, event_functions); +export var setup = function () { + if (arguments.length) { + var __ilastarg0__ = arguments.length - 1; + if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { + var __allkwargs0__ = arguments [__ilastarg0__--]; + for (var __attrib0__ in __allkwargs0__) { + } + } + } + else { + } + // pass; +}; +export var draw = function () { + if (arguments.length) { + var __ilastarg0__ = arguments.length - 1; + if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { + var __allkwargs0__ = arguments [__ilastarg0__--]; + for (var __attrib0__ in __allkwargs0__) { + } + } + } + else { + } + // pass; +}; +export var deviceMoved = null; +export var deviceTurned = null; +export var deviceShaken = null; +export var keyPressed = null; +export var keyReleased = null; +export var keyTyped = null; +export var mouseMoved = null; +export var mouseDragged = null; +export var mousePressed = null; +export var mouseReleased = null; +export var mouseClicked = null; +export var doubleClicked = null; +export var mouseWheel = null; +export var touchStarted = null; +export var touchMoved = null; +export var touchEnded = null; +export var windowResized = null; +var setup = function () { + if (arguments.length) { + var __ilastarg0__ = arguments.length - 1; + if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { + var __allkwargs0__ = arguments [__ilastarg0__--]; + for (var __attrib0__ in __allkwargs0__) { + } + } + } + else { + } + createCanvas (640, 360, _P5_INSTANCE.WEBGL); + fill (204); +}; +var draw = function () { + if (arguments.length) { + var __ilastarg0__ = arguments.length - 1; + if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) { + var __allkwargs0__ = arguments [__ilastarg0__--]; + for (var __attrib0__ in __allkwargs0__) { + } + } + } + else { + } + ambientLight (50); + directionalLight (255, 0, 0, 0.25, 0.25, 0); + background (0); + camera (30.0, mouseY, 220.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); + noStroke (); + box (90); + stroke (255); + line (-(100), 0, 0, 100, 0, 0); + line (0, -(100), 0, 0, 100, 0); + line (0, 0, -(100), 0, 0, 100); +}; +export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized}); +start_p5 (setup, draw, event_functions); //# sourceMappingURL=target_sketch.map \ No newline at end of file diff --git a/docs/examples/transcrypt/sketch_002/target/target_sketch.project b/docs/examples/transcrypt/sketch_002/target/target_sketch.project index 428f3b6d..c08bdd50 100644 --- a/docs/examples/transcrypt/sketch_002/target/target_sketch.project +++ b/docs/examples/transcrypt/sketch_002/target/target_sketch.project @@ -1 +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, "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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_002/sketch_002.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_002/__target__/sketch_002.js"}]} \ No newline at end of file +{"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.9/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"}]} \ No newline at end of file diff --git a/docs/examples/transcrypt/sketch_002/target/target_sketch.py b/docs/examples/transcrypt/sketch_002/target/target_sketch.py index 6dd8b40a..5bc8a558 100644 --- a/docs/examples/transcrypt/sketch_002/target/target_sketch.py +++ b/docs/examples/transcrypt/sketch_002/target/target_sketch.py @@ -1,24 +1,79 @@ -import sketch_002 as source_sketch from pyp5js import * +def setup(): + pass + +def draw(): + pass + +deviceMoved = None +deviceTurned = None +deviceShaken = None +keyPressed = None +keyReleased = None +keyTyped = None +mouseMoved = None +mouseDragged = None +mousePressed = None +mouseReleased = None +mouseClicked = None +doubleClicked = None +mouseWheel = None +touchStarted = None +touchMoved = None +touchEnded = None +windowResized = None + + +""" + * Move Eye. + * by Simon Greenwold. + * + * The camera lifts up (controlled by mouseY) while looking at the same point. + """ + +def setup(): + createCanvas(640, 360, _P5_INSTANCE.WEBGL) + fill(204) + + +def draw(): + ambientLight(50) + directionalLight(255, 0, 0, 0.25, 0.25, 0); + background(0) + + # Change height of the camera with mouseY + camera(30.0, mouseY, 220.0, # eyeX, eyeY, eyeZ + 0.0, 0.0, 0.0, # centerX, centerY, centerZ + 0.0, 1.0, 0.0) # upX, upY, upZ + + noStroke() + box(90) + stroke(255) + line(-100, 0, 0, 100, 0, 0) + line(0, -100, 0, 0, 100, 0) + line(0, 0, -100, 0, 0, 100) + + + event_functions = { - "deviceMoved": source_sketch.deviceMoved, - "deviceTurned": source_sketch.deviceTurned, - "deviceShaken": source_sketch.deviceShaken, - "keyPressed": source_sketch.keyPressed, - "keyReleased": source_sketch.keyReleased, - "keyTyped": source_sketch.keyTyped, - "mouseMoved": source_sketch.mouseMoved, - "mouseDragged": source_sketch.mouseDragged, - "mousePressed": source_sketch.mousePressed, - "mouseReleased": source_sketch.mouseReleased, - "mouseClicked": source_sketch.mouseClicked, - "doubleClicked": source_sketch.doubleClicked, - "mouseWheel": source_sketch.mouseWheel, - "touchStarted": source_sketch.touchStarted, - "touchMoved": source_sketch.touchMoved, - "touchEnded": source_sketch.touchEnded, - "windowResized": source_sketch.windowResized, + "deviceMoved": deviceMoved, + "deviceTurned": deviceTurned, + "deviceShaken": deviceShaken, + "keyPressed": keyPressed, + "keyReleased": keyReleased, + "keyTyped": keyTyped, + "mouseMoved": mouseMoved, + "mouseDragged": mouseDragged, + "mousePressed": mousePressed, + "mouseReleased": mouseReleased, + "mouseClicked": mouseClicked, + "doubleClicked": doubleClicked, + "mouseWheel": mouseWheel, + "touchStarted": touchStarted, + "touchMoved": touchMoved, + "touchEnded": touchEnded, + "windowResized": windowResized, } -start_p5(source_sketch.setup, source_sketch.draw, event_functions) \ No newline at end of file +start_p5(setup, draw, event_functions) \ No newline at end of file diff --git a/docs/examples/transcrypt/sketch_003/index.html b/docs/examples/transcrypt/sketch_003/index.html index b6e7f2bb..0ae6ccbb 100644 --- a/docs/examples/transcrypt/sketch_003/index.html +++ b/docs/examples/transcrypt/sketch_003/index.html @@ -48,7 +48,6 @@
              
 # 3d example
-from pyp5js import *
 
 
 def setup():
diff --git a/docs/examples/transcrypt/sketch_003/sketch_003.py b/docs/examples/transcrypt/sketch_003/sketch_003.py
index d54d9c12..3029b751 100644
--- a/docs/examples/transcrypt/sketch_003/sketch_003.py
+++ b/docs/examples/transcrypt/sketch_003/sketch_003.py
@@ -1,5 +1,4 @@
 # 3d example
-from pyp5js import *
 
 
 def setup():
diff --git a/docs/examples/transcrypt/sketch_003/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_003/target/org.transcrypt.__runtime__.js
index 609ed93e..d95a5be5 100644
--- a/docs/examples/transcrypt/sketch_003/target/org.transcrypt.__runtime__.js
+++ b/docs/examples/transcrypt/sketch_003/target/org.transcrypt.__runtime__.js
@@ -1,10 +1,10 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:33
+// Transcrypt'ed from Python, 2021-10-14 12:26:18
 var __name__ = 'org.transcrypt.__runtime__';
 export var __envir__ = {};
 __envir__.interpreter_name = 'python';
 __envir__.transpiler_name = 'transcrypt';
 __envir__.executor_name = __envir__.transpiler_name;
-__envir__.transpiler_version = '3.7.16';
+__envir__.transpiler_version = '3.9.0';
 
 export function __nest__ (headObject, tailNames, value) {
     var current = headObject;
@@ -38,15 +38,14 @@ export function __init__ (module) {
     }
     return module.__all__;
 };
-export var __proxy__ = false;
-export function __get__ (self, func, quotedFuncName) {
-    if (self) {
-        if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {
+export function __get__ (aThis, func, quotedFuncName) {
+    if (aThis) {
+        if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) {
             if (quotedFuncName) {
-                Object.defineProperty (self, quotedFuncName, {
+                Object.defineProperty (aThis, quotedFuncName, {
                     value: function () {
                         var args = [] .slice.apply (arguments);
-                        return func.apply (null, [self] .concat (args));
+                        return func.apply (null, [aThis] .concat (args));
                     },
                     writable: true,
                     enumerable: true,
@@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) {
             }
             return function () {
                 var args = [] .slice.apply (arguments);
-                return func.apply (null, [self] .concat (args));
+                return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args));
             };
         }
         else {
@@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) {
         return func;
     }
 };
-export function __getcm__ (self, func, quotedFuncName) {
-    if (self.hasOwnProperty ('__class__')) {
+export function __getcm__ (aThis, func, quotedFuncName) {
+    if (aThis.hasOwnProperty ('__class__')) {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self.__class__] .concat (args));
+            return func.apply (null, [aThis.__class__] .concat (args));
         };
     }
     else {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self] .concat (args));
+            return func.apply (null, [aThis] .concat (args));
         };
     }
 };
-export function __getsm__ (self, func, quotedFuncName) {
+export function __getsm__ (aThis, func, quotedFuncName) {
     return func;
 };
 export var py_metatype = {
@@ -95,6 +94,9 @@ export var py_metatype = {
             var base = bases [index];
             for (var attrib in base) {
                 var descrip = Object.getOwnPropertyDescriptor (base, attrib);
+                if (descrip == null) {
+                    continue;
+                }
                 Object.defineProperty (cls, attrib, descrip);
             }
             for (let symbol of Object.getOwnPropertySymbols (base)) {
@@ -125,7 +127,7 @@ export var object = {
     __new__: function (args) {
         var instance = Object.create (this, {__class__: {value: this, enumerable: true}});
         if ('__getattr__' in this || '__setattr__' in this) {
-            instance = new Proxy (instance, {
+            instance.__proxy__ = new Proxy (instance, {
                 get: function (target, name) {
                     let result = target [name];
                     if (result == undefined) {
@@ -145,6 +147,7 @@ export var object = {
                     return true;
                 }
             })
+			instance = instance.__proxy__
         }
         this.__init__.apply (null, [instance] .concat (args));
         return instance;
@@ -1830,10 +1833,13 @@ export var Exception =  __class__ ('Exception', [BaseException], {
 			var args = tuple ();
 		}
 		self.__args__ = args;
-		try {
+		if (kwargs.error != null) {
 			self.stack = kwargs.error.stack;
 		}
-		catch (__except0__) {
+		else if (Error) {
+			self.stack = new Error ().stack;
+		}
+		else {
 			self.stack = 'No stack trace available';
 		}
 	});},
diff --git a/docs/examples/transcrypt/sketch_003/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_003/target/org.transcrypt.__runtime__.py
index 87834491..8b06f7ba 100644
--- a/docs/examples/transcrypt/sketch_003/target/org.transcrypt.__runtime__.py
+++ b/docs/examples/transcrypt/sketch_003/target/org.transcrypt.__runtime__.py
@@ -19,9 +19,11 @@ class Exception (BaseException):
     #__pragma__ ('kwargs')
     def __init__ (self, *args, **kwargs):
         self.__args__ = args
-        try:
+        if kwargs.error != None:
             self.stack = kwargs.error.stack # Integrate with JavaScript Error object
-        except:
+        elif Error:
+            self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one
+        else:
             self.stack = 'No stack trace available'
     #__pragma__ ('nokwargs')
         
diff --git a/docs/examples/transcrypt/sketch_003/target/pyp5js.js b/docs/examples/transcrypt/sketch_003/target/pyp5js.js
index b89a42eb..56b9ba0e 100644
--- a/docs/examples/transcrypt/sketch_003/target/pyp5js.js
+++ b/docs/examples/transcrypt/sketch_003/target/pyp5js.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:33
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:18
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
 import {PythonFunctions} from './python_functions.js';
 var __name__ = 'pyp5js';
 export var _P5_INSTANCE = null;
diff --git a/docs/examples/transcrypt/sketch_003/target/python_functions.js b/docs/examples/transcrypt/sketch_003/target/python_functions.js
index c5be0318..8c26a94a 100644
--- a/docs/examples/transcrypt/sketch_003/target/python_functions.js
+++ b/docs/examples/transcrypt/sketch_003/target/python_functions.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:33
-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';
+// Transcrypt'ed from Python, 2021-10-14 12:26:18
+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';
 var __name__ = 'python_functions';
 export var PythonFunctions =  __class__ ('PythonFunctions', [object], {
 	__module__: __name__,
diff --git a/docs/examples/transcrypt/sketch_003/target/sketch_003.js b/docs/examples/transcrypt/sketch_003/target/sketch_003.js
deleted file mode 100644
index 3e382d1d..00000000
--- a/docs/examples/transcrypt/sketch_003/target/sketch_003.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:33
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-var __name__ = 'sketch_003';
-export var setup = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	createCanvas (600, 600, WEBGL);
-};
-export var draw = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	background (200);
-	translate (-(100), -(100), 0);
-	push ();
-	normalMaterial ();
-	rotateZ (frameCount * 0.01);
-	rotateX (frameCount * 0.01);
-	rotateY (frameCount * 0.01);
-	box (50, 70, 100);
-	py_pop ();
-};
-
-//# sourceMappingURL=sketch_003.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_003/target/sketch_003.py b/docs/examples/transcrypt/sketch_003/target/sketch_003.py
deleted file mode 100644
index d54d9c12..00000000
--- a/docs/examples/transcrypt/sketch_003/target/sketch_003.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# 3d example
-from pyp5js import *
-
-
-def setup():
-    createCanvas(600, 600, WEBGL)
-
-def draw():
-    background(200)
-    translate(-100, -100, 0)
-    push()
-    normalMaterial()
-    rotateZ(frameCount * 0.01)
-    rotateX(frameCount * 0.01)
-    rotateY(frameCount * 0.01)
-    box(50, 70, 100)
-    pop()
diff --git a/docs/examples/transcrypt/sketch_003/target/target_sketch.js b/docs/examples/transcrypt/sketch_003/target/target_sketch.js
index 3b384f2d..96a84c60 100644
--- a/docs/examples/transcrypt/sketch_003/target/target_sketch.js
+++ b/docs/examples/transcrypt/sketch_003/target/target_sketch.js
@@ -1,9 +1,85 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:33
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-import * as source_sketch from './sketch_003.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:18
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
 var __name__ = '__main__';
-export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]);
-start_p5 (source_sketch.setup, source_sketch.draw, event_functions);
+export var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var deviceMoved = null;
+export var deviceTurned = null;
+export var deviceShaken = null;
+export var keyPressed = null;
+export var keyReleased = null;
+export var keyTyped = null;
+export var mouseMoved = null;
+export var mouseDragged = null;
+export var mousePressed = null;
+export var mouseReleased = null;
+export var mouseClicked = null;
+export var doubleClicked = null;
+export var mouseWheel = null;
+export var touchStarted = null;
+export var touchMoved = null;
+export var touchEnded = null;
+export var windowResized = null;
+var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	createCanvas (600, 600, WEBGL);
+};
+var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	background (200);
+	translate (-(100), -(100), 0);
+	push ();
+	normalMaterial ();
+	rotateZ (frameCount * 0.01);
+	rotateX (frameCount * 0.01);
+	rotateY (frameCount * 0.01);
+	box (50, 70, 100);
+	py_pop ();
+};
+export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized});
+start_p5 (setup, draw, event_functions);
 
 //# sourceMappingURL=target_sketch.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_003/target/target_sketch.project b/docs/examples/transcrypt/sketch_003/target/target_sketch.project
index 5b4412aa..4eedbc45 100644
--- a/docs/examples/transcrypt/sketch_003/target/target_sketch.project
+++ b/docs/examples/transcrypt/sketch_003/target/target_sketch.project
@@ -1 +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, "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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_003/sketch_003.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_003/__target__/sketch_003.js"}]}
\ No newline at end of file
+{"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.9/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"}]}
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_003/target/target_sketch.py b/docs/examples/transcrypt/sketch_003/target/target_sketch.py
index e752f6dc..a5972282 100644
--- a/docs/examples/transcrypt/sketch_003/target/target_sketch.py
+++ b/docs/examples/transcrypt/sketch_003/target/target_sketch.py
@@ -1,24 +1,67 @@
-import sketch_003 as source_sketch
 from pyp5js import *
 
+def setup():
+    pass
+
+def draw():
+    pass
+
+deviceMoved = None
+deviceTurned = None
+deviceShaken = None
+keyPressed = None
+keyReleased = None
+keyTyped = None
+mouseMoved = None
+mouseDragged = None
+mousePressed = None
+mouseReleased = None
+mouseClicked = None
+doubleClicked = None
+mouseWheel = None
+touchStarted = None
+touchMoved = None
+touchEnded = None
+windowResized = None
+
+
+# 3d example
+
+
+def setup():
+    createCanvas(600, 600, WEBGL)
+
+def draw():
+    background(200)
+    translate(-100, -100, 0)
+    push()
+    normalMaterial()
+    rotateZ(frameCount * 0.01)
+    rotateX(frameCount * 0.01)
+    rotateY(frameCount * 0.01)
+    box(50, 70, 100)
+    pop()
+
+
+
 event_functions = {
-    "deviceMoved": source_sketch.deviceMoved,
-    "deviceTurned": source_sketch.deviceTurned,
-    "deviceShaken": source_sketch.deviceShaken,
-    "keyPressed": source_sketch.keyPressed,
-    "keyReleased": source_sketch.keyReleased,
-    "keyTyped": source_sketch.keyTyped,
-    "mouseMoved": source_sketch.mouseMoved,
-    "mouseDragged": source_sketch.mouseDragged,
-    "mousePressed": source_sketch.mousePressed,
-    "mouseReleased": source_sketch.mouseReleased,
-    "mouseClicked": source_sketch.mouseClicked,
-    "doubleClicked": source_sketch.doubleClicked,
-    "mouseWheel": source_sketch.mouseWheel,
-    "touchStarted": source_sketch.touchStarted,
-    "touchMoved": source_sketch.touchMoved,
-    "touchEnded": source_sketch.touchEnded,
-    "windowResized": source_sketch.windowResized,
+    "deviceMoved": deviceMoved,
+    "deviceTurned": deviceTurned,
+    "deviceShaken": deviceShaken,
+    "keyPressed": keyPressed,
+    "keyReleased": keyReleased,
+    "keyTyped": keyTyped,
+    "mouseMoved": mouseMoved,
+    "mouseDragged": mouseDragged,
+    "mousePressed": mousePressed,
+    "mouseReleased": mouseReleased,
+    "mouseClicked": mouseClicked,
+    "doubleClicked": doubleClicked,
+    "mouseWheel": mouseWheel,
+    "touchStarted": touchStarted,
+    "touchMoved": touchMoved,
+    "touchEnded": touchEnded,
+    "windowResized": windowResized,
 }
 
-start_p5(source_sketch.setup, source_sketch.draw, event_functions)
\ No newline at end of file
+start_p5(setup, draw, event_functions)
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_004/index.html b/docs/examples/transcrypt/sketch_004/index.html
index 54282533..ecd75a33 100644
--- a/docs/examples/transcrypt/sketch_004/index.html
+++ b/docs/examples/transcrypt/sketch_004/index.html
@@ -50,8 +50,6 @@
 # From Prof. Claudio Esperança examples for BrythonIDE
 # https://github.com/esperanc/brythonide/blob/master/demoSketches/boids.py
 
-from pyp5js import *
-
 boids = [];
 
 def setup() :
diff --git a/docs/examples/transcrypt/sketch_004/sketch_004.py b/docs/examples/transcrypt/sketch_004/sketch_004.py
index 5d604f76..800f0811 100644
--- a/docs/examples/transcrypt/sketch_004/sketch_004.py
+++ b/docs/examples/transcrypt/sketch_004/sketch_004.py
@@ -1,8 +1,6 @@
 # From Prof. Claudio Esperança examples for BrythonIDE
 # https://github.com/esperanc/brythonide/blob/master/demoSketches/boids.py
 
-from pyp5js import *
-
 boids = [];
 
 def setup() :
diff --git a/docs/examples/transcrypt/sketch_004/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_004/target/org.transcrypt.__runtime__.js
index ddd35f79..dd650ebc 100644
--- a/docs/examples/transcrypt/sketch_004/target/org.transcrypt.__runtime__.js
+++ b/docs/examples/transcrypt/sketch_004/target/org.transcrypt.__runtime__.js
@@ -1,10 +1,10 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:34
+// Transcrypt'ed from Python, 2021-10-14 12:26:19
 var __name__ = 'org.transcrypt.__runtime__';
 export var __envir__ = {};
 __envir__.interpreter_name = 'python';
 __envir__.transpiler_name = 'transcrypt';
 __envir__.executor_name = __envir__.transpiler_name;
-__envir__.transpiler_version = '3.7.16';
+__envir__.transpiler_version = '3.9.0';
 
 export function __nest__ (headObject, tailNames, value) {
     var current = headObject;
@@ -38,15 +38,14 @@ export function __init__ (module) {
     }
     return module.__all__;
 };
-export var __proxy__ = false;
-export function __get__ (self, func, quotedFuncName) {
-    if (self) {
-        if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {
+export function __get__ (aThis, func, quotedFuncName) {
+    if (aThis) {
+        if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) {
             if (quotedFuncName) {
-                Object.defineProperty (self, quotedFuncName, {
+                Object.defineProperty (aThis, quotedFuncName, {
                     value: function () {
                         var args = [] .slice.apply (arguments);
-                        return func.apply (null, [self] .concat (args));
+                        return func.apply (null, [aThis] .concat (args));
                     },
                     writable: true,
                     enumerable: true,
@@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) {
             }
             return function () {
                 var args = [] .slice.apply (arguments);
-                return func.apply (null, [self] .concat (args));
+                return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args));
             };
         }
         else {
@@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) {
         return func;
     }
 };
-export function __getcm__ (self, func, quotedFuncName) {
-    if (self.hasOwnProperty ('__class__')) {
+export function __getcm__ (aThis, func, quotedFuncName) {
+    if (aThis.hasOwnProperty ('__class__')) {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self.__class__] .concat (args));
+            return func.apply (null, [aThis.__class__] .concat (args));
         };
     }
     else {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self] .concat (args));
+            return func.apply (null, [aThis] .concat (args));
         };
     }
 };
-export function __getsm__ (self, func, quotedFuncName) {
+export function __getsm__ (aThis, func, quotedFuncName) {
     return func;
 };
 export var py_metatype = {
@@ -95,6 +94,9 @@ export var py_metatype = {
             var base = bases [index];
             for (var attrib in base) {
                 var descrip = Object.getOwnPropertyDescriptor (base, attrib);
+                if (descrip == null) {
+                    continue;
+                }
                 Object.defineProperty (cls, attrib, descrip);
             }
             for (let symbol of Object.getOwnPropertySymbols (base)) {
@@ -125,7 +127,7 @@ export var object = {
     __new__: function (args) {
         var instance = Object.create (this, {__class__: {value: this, enumerable: true}});
         if ('__getattr__' in this || '__setattr__' in this) {
-            instance = new Proxy (instance, {
+            instance.__proxy__ = new Proxy (instance, {
                 get: function (target, name) {
                     let result = target [name];
                     if (result == undefined) {
@@ -145,6 +147,7 @@ export var object = {
                     return true;
                 }
             })
+			instance = instance.__proxy__
         }
         this.__init__.apply (null, [instance] .concat (args));
         return instance;
@@ -1830,10 +1833,13 @@ export var Exception =  __class__ ('Exception', [BaseException], {
 			var args = tuple ();
 		}
 		self.__args__ = args;
-		try {
+		if (kwargs.error != null) {
 			self.stack = kwargs.error.stack;
 		}
-		catch (__except0__) {
+		else if (Error) {
+			self.stack = new Error ().stack;
+		}
+		else {
 			self.stack = 'No stack trace available';
 		}
 	});},
diff --git a/docs/examples/transcrypt/sketch_004/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_004/target/org.transcrypt.__runtime__.py
index 87834491..8b06f7ba 100644
--- a/docs/examples/transcrypt/sketch_004/target/org.transcrypt.__runtime__.py
+++ b/docs/examples/transcrypt/sketch_004/target/org.transcrypt.__runtime__.py
@@ -19,9 +19,11 @@ class Exception (BaseException):
     #__pragma__ ('kwargs')
     def __init__ (self, *args, **kwargs):
         self.__args__ = args
-        try:
+        if kwargs.error != None:
             self.stack = kwargs.error.stack # Integrate with JavaScript Error object
-        except:
+        elif Error:
+            self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one
+        else:
             self.stack = 'No stack trace available'
     #__pragma__ ('nokwargs')
         
diff --git a/docs/examples/transcrypt/sketch_004/target/pyp5js.js b/docs/examples/transcrypt/sketch_004/target/pyp5js.js
index 7d4da120..ee17e809 100644
--- a/docs/examples/transcrypt/sketch_004/target/pyp5js.js
+++ b/docs/examples/transcrypt/sketch_004/target/pyp5js.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:34
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:19
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
 import {PythonFunctions} from './python_functions.js';
 var __name__ = 'pyp5js';
 export var _P5_INSTANCE = null;
diff --git a/docs/examples/transcrypt/sketch_004/target/python_functions.js b/docs/examples/transcrypt/sketch_004/target/python_functions.js
index fd5fa626..80e00b6c 100644
--- a/docs/examples/transcrypt/sketch_004/target/python_functions.js
+++ b/docs/examples/transcrypt/sketch_004/target/python_functions.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:34
-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';
+// Transcrypt'ed from Python, 2021-10-14 12:26:20
+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';
 var __name__ = 'python_functions';
 export var PythonFunctions =  __class__ ('PythonFunctions', [object], {
 	__module__: __name__,
diff --git a/docs/examples/transcrypt/sketch_004/target/sketch_004.js b/docs/examples/transcrypt/sketch_004/target/sketch_004.js
deleted file mode 100644
index b00c8435..00000000
--- a/docs/examples/transcrypt/sketch_004/target/sketch_004.js
+++ /dev/null
@@ -1,322 +0,0 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:34
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-var __name__ = 'sketch_004';
-export var boids = [];
-export var setup = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	createCanvas (720, 400);
-	for (var i = 0; i < 40; i++) {
-		boids.append (Boid (random (720), random (400)));
-	}
-};
-export var draw = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	background (51);
-	for (var boid of boids) {
-		boid.run (boids);
-	}
-};
-export var Boid =  __class__ ('Boid', [object], {
-	__module__: __name__,
-	get __init__ () {return __get__ (this, function (self, x, y) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-						case 'x': var x = __allkwargs0__ [__attrib0__]; break;
-						case 'y': var y = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		self.acceleration = createVector (0, 0);
-		self.velocity = p5.Vector.random2D ();
-		self.position = createVector (x, y);
-		self.r = 3.0;
-		self.maxspeed = 3;
-		self.maxforce = 0.05;
-	});},
-	get run () {return __get__ (this, function (self, boids) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		self.flock (boids);
-		self.py_update ();
-		self.borders ();
-		self.render ();
-	});},
-	get applyForce () {return __get__ (this, function (self, force) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-						case 'force': var force = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		self.acceleration.add (force);
-	});},
-	get flock () {return __get__ (this, function (self, boids) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		var sep = self.separate (boids);
-		var ali = self.align (boids);
-		var coh = self.cohesion (boids);
-		sep.mult (2.5);
-		ali.mult (1.0);
-		coh.mult (1.0);
-		self.applyForce (sep);
-		self.applyForce (ali);
-		self.applyForce (coh);
-	});},
-	get py_update () {return __get__ (this, function (self) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		self.velocity.add (self.acceleration);
-		self.velocity.limit (self.maxspeed);
-		self.position.add (self.velocity);
-		self.acceleration.mult (0);
-	});},
-	get seek () {return __get__ (this, function (self, target) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-						case 'target': var target = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		var desired = p5.Vector.sub (target, self.position);
-		desired.normalize ();
-		desired.mult (self.maxspeed);
-		var steer = p5.Vector.sub (desired, self.velocity);
-		steer.limit (self.maxforce);
-		return steer;
-	});},
-	get render () {return __get__ (this, function (self) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		fill (127, 127);
-		stroke (200);
-		ellipse (self.position.x, self.position.y, 16, 16);
-	});},
-	get borders () {return __get__ (this, function (self) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		if (self.position.x < -(self.r)) {
-			self.position.x = width + self.r;
-		}
-		if (self.position.y < -(self.r)) {
-			self.position.y = height + self.r;
-		}
-		if (self.position.x > width + self.r) {
-			self.position.x = -(self.r);
-		}
-		if (self.position.y > height + self.r) {
-			self.position.y = -(self.r);
-		}
-	});},
-	get separate () {return __get__ (this, function (self, boids) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		var desiredseparation = 25.0;
-		var steer = createVector (0, 0);
-		var count = 0;
-		for (var i = 0; i < len (boids); i++) {
-			var d = p5.Vector.dist (self.position, boids [i].position);
-			if (d > 0 && d < desiredseparation) {
-				var diff = p5.Vector.sub (self.position, boids [i].position);
-				diff.normalize ();
-				diff.div (d);
-				steer.add (diff);
-				count += 1;
-			}
-		}
-		if (count > 0) {
-			steer.div (count);
-		}
-		if (steer.mag () > 0) {
-			steer.normalize ();
-			steer.mult (self.maxspeed);
-			steer.sub (self.velocity);
-			steer.limit (self.maxforce);
-		}
-		return steer;
-	});},
-	get align () {return __get__ (this, function (self, boids) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		var neighbordist = 50;
-		var sum = createVector (0, 0);
-		var count = 0;
-		for (var i = 0; i < len (boids); i++) {
-			var d = p5.Vector.dist (self.position, boids [i].position);
-			if (d > 0 && d < neighbordist) {
-				sum.add (boids [i].velocity);
-				count += 1;
-			}
-		}
-		if (count > 0) {
-			sum.div (count);
-			sum.normalize ();
-			sum.mult (self.maxspeed);
-			var steer = p5.Vector.sub (sum, self.velocity);
-			steer.limit (self.maxforce);
-			return steer;
-		}
-		else {
-			return createVector (0, 0);
-		}
-	});},
-	get cohesion () {return __get__ (this, function (self, boids) {
-		if (arguments.length) {
-			var __ilastarg0__ = arguments.length - 1;
-			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-				var __allkwargs0__ = arguments [__ilastarg0__--];
-				for (var __attrib0__ in __allkwargs0__) {
-					switch (__attrib0__) {
-						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
-						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
-					}
-				}
-			}
-		}
-		else {
-		}
-		var neighbordist = 50;
-		var sum = createVector (0, 0);
-		var count = 0;
-		for (var i = 0; i < len (boids); i++) {
-			var d = p5.Vector.dist (self.position, boids [i].position);
-			if (d > 0 && d < neighbordist) {
-				sum.add (boids [i].position);
-				count += 1;
-			}
-		}
-		if (count > 0) {
-			sum.div (count);
-			return self.seek (sum);
-		}
-		else {
-			return createVector (0, 0);
-		}
-	});}
-});
-
-//# sourceMappingURL=sketch_004.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_004/target/sketch_004.py b/docs/examples/transcrypt/sketch_004/target/sketch_004.py
deleted file mode 100644
index 5d604f76..00000000
--- a/docs/examples/transcrypt/sketch_004/target/sketch_004.py
+++ /dev/null
@@ -1,164 +0,0 @@
-# From Prof. Claudio Esperança examples for BrythonIDE
-# https://github.com/esperanc/brythonide/blob/master/demoSketches/boids.py
-
-from pyp5js import *
-
-boids = [];
-
-def setup() :
-  createCanvas(720, 400);
-
-  # Add an initial set of boids into the system
-  for i in range(40):
-    boids.append (Boid(random(720), random(400)))
-
-def draw() :
-  background(51);
-  # Run all the boids
-  for boid in boids: boid.run(boids)
-
-
-# Boid class
-# Methods for Separation, Cohesion, Alignment added
-class Boid (object):
-
-    def __init__(self, x, y) :
-        self.acceleration = createVector(0, 0);
-        self.velocity = p5.Vector.random2D();
-        self.position = createVector(x, y);
-        self.r = 3.0;
-        self.maxspeed = 3;    # Maximum speed
-        self.maxforce = 0.05; # Maximum steering force
-
-    def run (self, boids):
-        self.flock(boids);
-        self.update();
-        self.borders();
-        self.render();
-
-    # Forces go into acceleration
-    def applyForce (self,force):
-        self.acceleration.add(force);
-
-    # We accumulate a new acceleration each time based on three rules
-    def flock (self, boids) :
-        sep = self.separate(boids); # Separation
-        ali = self.align(boids);    # Alignment
-        coh = self.cohesion(boids); # Cohesion
-        # Arbitrarily weight these forces
-        sep.mult(2.5);
-        ali.mult(1.0);
-        coh.mult(1.0);
-        # Add the force vectors to acceleration
-        self.applyForce(sep);
-        self.applyForce(ali);
-        self.applyForce(coh);
-
-    # Method to update location
-    def update (self) :
-        # Update velocity
-        self.velocity.add(self.acceleration);
-        # Limit speed
-        self.velocity.limit(self.maxspeed);
-        self.position.add(self.velocity);
-        # Reset acceleration to 0 each cycle
-        self.acceleration.mult(0);
-
-    # A method that calculates and applies a steering force towards a target
-    # STEER = DESIRED MINUS VELOCITY
-    def seek (self,target):
-        desired = p5.Vector.sub(target, self.position); # A vector pointing from the location to the target
-        # Normalize desired and scale to maximum speed
-        desired.normalize();
-        desired.mult(self.maxspeed);
-        # Steering = Desired minus Velocity
-        steer = p5.Vector.sub(desired, self.velocity);
-        steer.limit(self.maxforce); # Limit to maximum steering force
-        return steer;
-
-    # Draw boid as a circle
-    def render (self) :
-        fill(127, 127);
-        stroke(200);
-        ellipse(self.position.x, self.position.y, 16, 16);
-
-    # Wraparound
-    def borders (self) :
-        if (self.position.x < -self.r): self.position.x = width + self.r;
-        if (self.position.y < -self.r): self.position.y = height + self.r;
-        if (self.position.x > width + self.r): self.position.x = -self.r;
-        if (self.position.y > height + self.r): self.position.y = -self.r;
-
-
-    # Separation
-    # Method checks for nearby boids and steers away
-    def separate (self, boids) :
-        desiredseparation = 25.0;
-        steer = createVector(0, 0);
-        count = 0;
-        # For every boid in the system, check if it's too close
-        for i in range(len(boids)):
-            d = p5.Vector.dist(self.position, boids[i].position);
-            # If the distance is greater than 0 and less than an arbitrary amount (0 when you are yourself)
-            if ((d > 0) and (d < desiredseparation)) :
-              # Calculate vector pointing away from neighbor
-              diff = p5.Vector.sub(self.position, boids[i].position);
-              diff.normalize();
-              diff.div(d); # Weight by distance
-              steer.add(diff);
-              count+=1; # Keep track of how many
-        # Average -- divide by how many
-        if (count > 0) :
-            steer.div(count);
-
-
-        # As long as the vector is greater than 0
-        if (steer.mag() > 0) :
-            # Implement Reynolds: Steering = Desired - Velocity
-            steer.normalize();
-            steer.mult(self.maxspeed);
-            steer.sub(self.velocity);
-            steer.limit(self.maxforce);
-
-        return steer;
-
-
-    # Alignment
-    # For every nearby boid in the system, calculate the average velocity
-    def align (self, boids) :
-      neighbordist = 50;
-      sum = createVector(0, 0);
-      count = 0;
-      for i in range(len(boids)):
-        d = p5.Vector.dist(self.position, boids[i].position);
-        if ((d > 0) and (d < neighbordist)) :
-          sum.add(boids[i].velocity);
-          count+=1;
-
-      if (count > 0) :
-        sum.div(count);
-        sum.normalize();
-        sum.mult(self.maxspeed);
-        steer = p5.Vector.sub(sum, self.velocity);
-        steer.limit(self.maxforce);
-        return steer;
-      else:
-        return createVector(0, 0);
-
-    # Cohesion
-    # For the average location (i.e. center) of all nearby boids, calculate steering vector towards that location
-    def cohesion  (self, boids) :
-      neighbordist = 50;
-      sum = createVector(0, 0); # Start with empty vector to accumulate all locations
-      count = 0;
-      for i in range(len(boids)):
-        d = p5.Vector.dist(self.position, boids[i].position);
-        if ((d > 0) and (d < neighbordist)) :
-          sum.add(boids[i].position); # Add location
-          count+=1;
-
-      if (count > 0) :
-        sum.div(count);
-        return self.seek(sum); # Steer towards the location
-      else:
-        return createVector(0, 0);
diff --git a/docs/examples/transcrypt/sketch_004/target/target_sketch.js b/docs/examples/transcrypt/sketch_004/target/target_sketch.js
index d23e3f96..1e0f9286 100644
--- a/docs/examples/transcrypt/sketch_004/target/target_sketch.js
+++ b/docs/examples/transcrypt/sketch_004/target/target_sketch.js
@@ -1,9 +1,367 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:34
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-import * as source_sketch from './sketch_004.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:19
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
 var __name__ = '__main__';
-export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]);
-start_p5 (source_sketch.setup, source_sketch.draw, event_functions);
+export var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var deviceMoved = null;
+export var deviceTurned = null;
+export var deviceShaken = null;
+export var keyPressed = null;
+export var keyReleased = null;
+export var keyTyped = null;
+export var mouseMoved = null;
+export var mouseDragged = null;
+export var mousePressed = null;
+export var mouseReleased = null;
+export var mouseClicked = null;
+export var doubleClicked = null;
+export var mouseWheel = null;
+export var touchStarted = null;
+export var touchMoved = null;
+export var touchEnded = null;
+export var windowResized = null;
+export var boids = [];
+var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	createCanvas (720, 400);
+	for (var i = 0; i < 40; i++) {
+		boids.append (Boid (random (720), random (400)));
+	}
+};
+var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	background (51);
+	for (var boid of boids) {
+		boid.run (boids);
+	}
+};
+export var Boid =  __class__ ('Boid', [object], {
+	__module__: __name__,
+	get __init__ () {return __get__ (this, function (self, x, y) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+						case 'x': var x = __allkwargs0__ [__attrib0__]; break;
+						case 'y': var y = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		self.acceleration = createVector (0, 0);
+		self.velocity = p5.Vector.random2D ();
+		self.position = createVector (x, y);
+		self.r = 3.0;
+		self.maxspeed = 3;
+		self.maxforce = 0.05;
+	});},
+	get run () {return __get__ (this, function (self, boids) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		self.flock (boids);
+		self.py_update ();
+		self.borders ();
+		self.render ();
+	});},
+	get applyForce () {return __get__ (this, function (self, force) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+						case 'force': var force = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		self.acceleration.add (force);
+	});},
+	get flock () {return __get__ (this, function (self, boids) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		var sep = self.separate (boids);
+		var ali = self.align (boids);
+		var coh = self.cohesion (boids);
+		sep.mult (2.5);
+		ali.mult (1.0);
+		coh.mult (1.0);
+		self.applyForce (sep);
+		self.applyForce (ali);
+		self.applyForce (coh);
+	});},
+	get py_update () {return __get__ (this, function (self) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		self.velocity.add (self.acceleration);
+		self.velocity.limit (self.maxspeed);
+		self.position.add (self.velocity);
+		self.acceleration.mult (0);
+	});},
+	get seek () {return __get__ (this, function (self, target) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+						case 'target': var target = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		var desired = p5.Vector.sub (target, self.position);
+		desired.normalize ();
+		desired.mult (self.maxspeed);
+		var steer = p5.Vector.sub (desired, self.velocity);
+		steer.limit (self.maxforce);
+		return steer;
+	});},
+	get render () {return __get__ (this, function (self) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		fill (127, 127);
+		stroke (200);
+		ellipse (self.position.x, self.position.y, 16, 16);
+	});},
+	get borders () {return __get__ (this, function (self) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		if (self.position.x < -(self.r)) {
+			self.position.x = width + self.r;
+		}
+		if (self.position.y < -(self.r)) {
+			self.position.y = height + self.r;
+		}
+		if (self.position.x > width + self.r) {
+			self.position.x = -(self.r);
+		}
+		if (self.position.y > height + self.r) {
+			self.position.y = -(self.r);
+		}
+	});},
+	get separate () {return __get__ (this, function (self, boids) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		var desiredseparation = 25.0;
+		var steer = createVector (0, 0);
+		var count = 0;
+		for (var i = 0; i < len (boids); i++) {
+			var d = p5.Vector.dist (self.position, boids [i].position);
+			if (d > 0 && d < desiredseparation) {
+				var diff = p5.Vector.sub (self.position, boids [i].position);
+				diff.normalize ();
+				diff.div (d);
+				steer.add (diff);
+				count++;
+			}
+		}
+		if (count > 0) {
+			steer.div (count);
+		}
+		if (steer.mag () > 0) {
+			steer.normalize ();
+			steer.mult (self.maxspeed);
+			steer.sub (self.velocity);
+			steer.limit (self.maxforce);
+		}
+		return steer;
+	});},
+	get align () {return __get__ (this, function (self, boids) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		var neighbordist = 50;
+		var sum = createVector (0, 0);
+		var count = 0;
+		for (var i = 0; i < len (boids); i++) {
+			var d = p5.Vector.dist (self.position, boids [i].position);
+			if (d > 0 && d < neighbordist) {
+				sum.add (boids [i].velocity);
+				count++;
+			}
+		}
+		if (count > 0) {
+			sum.div (count);
+			sum.normalize ();
+			sum.mult (self.maxspeed);
+			var steer = p5.Vector.sub (sum, self.velocity);
+			steer.limit (self.maxforce);
+			return steer;
+		}
+		else {
+			return createVector (0, 0);
+		}
+	});},
+	get cohesion () {return __get__ (this, function (self, boids) {
+		if (arguments.length) {
+			var __ilastarg0__ = arguments.length - 1;
+			if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+				var __allkwargs0__ = arguments [__ilastarg0__--];
+				for (var __attrib0__ in __allkwargs0__) {
+					switch (__attrib0__) {
+						case 'self': var self = __allkwargs0__ [__attrib0__]; break;
+						case 'boids': var boids = __allkwargs0__ [__attrib0__]; break;
+					}
+				}
+			}
+		}
+		else {
+		}
+		var neighbordist = 50;
+		var sum = createVector (0, 0);
+		var count = 0;
+		for (var i = 0; i < len (boids); i++) {
+			var d = p5.Vector.dist (self.position, boids [i].position);
+			if (d > 0 && d < neighbordist) {
+				sum.add (boids [i].position);
+				count++;
+			}
+		}
+		if (count > 0) {
+			sum.div (count);
+			return self.seek (sum);
+		}
+		else {
+			return createVector (0, 0);
+		}
+	});}
+});
+export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized});
+start_p5 (setup, draw, event_functions);
 
 //# sourceMappingURL=target_sketch.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_004/target/target_sketch.project b/docs/examples/transcrypt/sketch_004/target/target_sketch.project
index a1774970..b5ce1549 100644
--- a/docs/examples/transcrypt/sketch_004/target/target_sketch.project
+++ b/docs/examples/transcrypt/sketch_004/target/target_sketch.project
@@ -1 +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, "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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_004/sketch_004.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_004/__target__/sketch_004.js"}]}
\ No newline at end of file
+{"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.9/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"}]}
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_004/target/target_sketch.py b/docs/examples/transcrypt/sketch_004/target/target_sketch.py
index a993286f..aae72bb0 100644
--- a/docs/examples/transcrypt/sketch_004/target/target_sketch.py
+++ b/docs/examples/transcrypt/sketch_004/target/target_sketch.py
@@ -1,24 +1,213 @@
-import sketch_004 as source_sketch
 from pyp5js import *
 
+def setup():
+    pass
+
+def draw():
+    pass
+
+deviceMoved = None
+deviceTurned = None
+deviceShaken = None
+keyPressed = None
+keyReleased = None
+keyTyped = None
+mouseMoved = None
+mouseDragged = None
+mousePressed = None
+mouseReleased = None
+mouseClicked = None
+doubleClicked = None
+mouseWheel = None
+touchStarted = None
+touchMoved = None
+touchEnded = None
+windowResized = None
+
+
+# From Prof. Claudio Esperança examples for BrythonIDE
+# https://github.com/esperanc/brythonide/blob/master/demoSketches/boids.py
+
+boids = [];
+
+def setup() :
+  createCanvas(720, 400);
+
+  # Add an initial set of boids into the system
+  for i in range(40):
+    boids.append (Boid(random(720), random(400)))
+
+def draw() :
+  background(51);
+  # Run all the boids
+  for boid in boids: boid.run(boids)
+
+
+# Boid class
+# Methods for Separation, Cohesion, Alignment added
+class Boid (object):
+
+    def __init__(self, x, y) :
+        self.acceleration = createVector(0, 0);
+        self.velocity = p5.Vector.random2D();
+        self.position = createVector(x, y);
+        self.r = 3.0;
+        self.maxspeed = 3;    # Maximum speed
+        self.maxforce = 0.05; # Maximum steering force
+
+    def run (self, boids):
+        self.flock(boids);
+        self.update();
+        self.borders();
+        self.render();
+
+    # Forces go into acceleration
+    def applyForce (self,force):
+        self.acceleration.add(force);
+
+    # We accumulate a new acceleration each time based on three rules
+    def flock (self, boids) :
+        sep = self.separate(boids); # Separation
+        ali = self.align(boids);    # Alignment
+        coh = self.cohesion(boids); # Cohesion
+        # Arbitrarily weight these forces
+        sep.mult(2.5);
+        ali.mult(1.0);
+        coh.mult(1.0);
+        # Add the force vectors to acceleration
+        self.applyForce(sep);
+        self.applyForce(ali);
+        self.applyForce(coh);
+
+    # Method to update location
+    def update (self) :
+        # Update velocity
+        self.velocity.add(self.acceleration);
+        # Limit speed
+        self.velocity.limit(self.maxspeed);
+        self.position.add(self.velocity);
+        # Reset acceleration to 0 each cycle
+        self.acceleration.mult(0);
+
+    # A method that calculates and applies a steering force towards a target
+    # STEER = DESIRED MINUS VELOCITY
+    def seek (self,target):
+        desired = p5.Vector.sub(target, self.position); # A vector pointing from the location to the target
+        # Normalize desired and scale to maximum speed
+        desired.normalize();
+        desired.mult(self.maxspeed);
+        # Steering = Desired minus Velocity
+        steer = p5.Vector.sub(desired, self.velocity);
+        steer.limit(self.maxforce); # Limit to maximum steering force
+        return steer;
+
+    # Draw boid as a circle
+    def render (self) :
+        fill(127, 127);
+        stroke(200);
+        ellipse(self.position.x, self.position.y, 16, 16);
+
+    # Wraparound
+    def borders (self) :
+        if (self.position.x < -self.r): self.position.x = width + self.r;
+        if (self.position.y < -self.r): self.position.y = height + self.r;
+        if (self.position.x > width + self.r): self.position.x = -self.r;
+        if (self.position.y > height + self.r): self.position.y = -self.r;
+
+
+    # Separation
+    # Method checks for nearby boids and steers away
+    def separate (self, boids) :
+        desiredseparation = 25.0;
+        steer = createVector(0, 0);
+        count = 0;
+        # For every boid in the system, check if it's too close
+        for i in range(len(boids)):
+            d = p5.Vector.dist(self.position, boids[i].position);
+            # If the distance is greater than 0 and less than an arbitrary amount (0 when you are yourself)
+            if ((d > 0) and (d < desiredseparation)) :
+              # Calculate vector pointing away from neighbor
+              diff = p5.Vector.sub(self.position, boids[i].position);
+              diff.normalize();
+              diff.div(d); # Weight by distance
+              steer.add(diff);
+              count+=1; # Keep track of how many
+        # Average -- divide by how many
+        if (count > 0) :
+            steer.div(count);
+
+
+        # As long as the vector is greater than 0
+        if (steer.mag() > 0) :
+            # Implement Reynolds: Steering = Desired - Velocity
+            steer.normalize();
+            steer.mult(self.maxspeed);
+            steer.sub(self.velocity);
+            steer.limit(self.maxforce);
+
+        return steer;
+
+
+    # Alignment
+    # For every nearby boid in the system, calculate the average velocity
+    def align (self, boids) :
+      neighbordist = 50;
+      sum = createVector(0, 0);
+      count = 0;
+      for i in range(len(boids)):
+        d = p5.Vector.dist(self.position, boids[i].position);
+        if ((d > 0) and (d < neighbordist)) :
+          sum.add(boids[i].velocity);
+          count+=1;
+
+      if (count > 0) :
+        sum.div(count);
+        sum.normalize();
+        sum.mult(self.maxspeed);
+        steer = p5.Vector.sub(sum, self.velocity);
+        steer.limit(self.maxforce);
+        return steer;
+      else:
+        return createVector(0, 0);
+
+    # Cohesion
+    # For the average location (i.e. center) of all nearby boids, calculate steering vector towards that location
+    def cohesion  (self, boids) :
+      neighbordist = 50;
+      sum = createVector(0, 0); # Start with empty vector to accumulate all locations
+      count = 0;
+      for i in range(len(boids)):
+        d = p5.Vector.dist(self.position, boids[i].position);
+        if ((d > 0) and (d < neighbordist)) :
+          sum.add(boids[i].position); # Add location
+          count+=1;
+
+      if (count > 0) :
+        sum.div(count);
+        return self.seek(sum); # Steer towards the location
+      else:
+        return createVector(0, 0);
+
+
+
 event_functions = {
-    "deviceMoved": source_sketch.deviceMoved,
-    "deviceTurned": source_sketch.deviceTurned,
-    "deviceShaken": source_sketch.deviceShaken,
-    "keyPressed": source_sketch.keyPressed,
-    "keyReleased": source_sketch.keyReleased,
-    "keyTyped": source_sketch.keyTyped,
-    "mouseMoved": source_sketch.mouseMoved,
-    "mouseDragged": source_sketch.mouseDragged,
-    "mousePressed": source_sketch.mousePressed,
-    "mouseReleased": source_sketch.mouseReleased,
-    "mouseClicked": source_sketch.mouseClicked,
-    "doubleClicked": source_sketch.doubleClicked,
-    "mouseWheel": source_sketch.mouseWheel,
-    "touchStarted": source_sketch.touchStarted,
-    "touchMoved": source_sketch.touchMoved,
-    "touchEnded": source_sketch.touchEnded,
-    "windowResized": source_sketch.windowResized,
+    "deviceMoved": deviceMoved,
+    "deviceTurned": deviceTurned,
+    "deviceShaken": deviceShaken,
+    "keyPressed": keyPressed,
+    "keyReleased": keyReleased,
+    "keyTyped": keyTyped,
+    "mouseMoved": mouseMoved,
+    "mouseDragged": mouseDragged,
+    "mousePressed": mousePressed,
+    "mouseReleased": mouseReleased,
+    "mouseClicked": mouseClicked,
+    "doubleClicked": doubleClicked,
+    "mouseWheel": mouseWheel,
+    "touchStarted": touchStarted,
+    "touchMoved": touchMoved,
+    "touchEnded": touchEnded,
+    "windowResized": windowResized,
 }
 
-start_p5(source_sketch.setup, source_sketch.draw, event_functions)
\ No newline at end of file
+start_p5(setup, draw, event_functions)
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_005/index.html b/docs/examples/transcrypt/sketch_005/index.html
index 9efd0fe2..d0a08c00 100644
--- a/docs/examples/transcrypt/sketch_005/index.html
+++ b/docs/examples/transcrypt/sketch_005/index.html
@@ -47,9 +47,6 @@
         
              
-from pyp5js import *
-
-
 def setup():
     createCanvas(600,600)
     noStroke()
diff --git a/docs/examples/transcrypt/sketch_005/sketch_005.py b/docs/examples/transcrypt/sketch_005/sketch_005.py
index 2dfca4be..997fb196 100644
--- a/docs/examples/transcrypt/sketch_005/sketch_005.py
+++ b/docs/examples/transcrypt/sketch_005/sketch_005.py
@@ -1,6 +1,3 @@
-from pyp5js import *
-
-
 def setup():
     createCanvas(600,600)
     noStroke()
diff --git a/docs/examples/transcrypt/sketch_005/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_005/target/org.transcrypt.__runtime__.js
index f9dbe647..f58efad8 100644
--- a/docs/examples/transcrypt/sketch_005/target/org.transcrypt.__runtime__.js
+++ b/docs/examples/transcrypt/sketch_005/target/org.transcrypt.__runtime__.js
@@ -1,10 +1,10 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:35
+// Transcrypt'ed from Python, 2021-10-14 12:26:21
 var __name__ = 'org.transcrypt.__runtime__';
 export var __envir__ = {};
 __envir__.interpreter_name = 'python';
 __envir__.transpiler_name = 'transcrypt';
 __envir__.executor_name = __envir__.transpiler_name;
-__envir__.transpiler_version = '3.7.16';
+__envir__.transpiler_version = '3.9.0';
 
 export function __nest__ (headObject, tailNames, value) {
     var current = headObject;
@@ -38,15 +38,14 @@ export function __init__ (module) {
     }
     return module.__all__;
 };
-export var __proxy__ = false;
-export function __get__ (self, func, quotedFuncName) {
-    if (self) {
-        if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {
+export function __get__ (aThis, func, quotedFuncName) {
+    if (aThis) {
+        if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) {
             if (quotedFuncName) {
-                Object.defineProperty (self, quotedFuncName, {
+                Object.defineProperty (aThis, quotedFuncName, {
                     value: function () {
                         var args = [] .slice.apply (arguments);
-                        return func.apply (null, [self] .concat (args));
+                        return func.apply (null, [aThis] .concat (args));
                     },
                     writable: true,
                     enumerable: true,
@@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) {
             }
             return function () {
                 var args = [] .slice.apply (arguments);
-                return func.apply (null, [self] .concat (args));
+                return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args));
             };
         }
         else {
@@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) {
         return func;
     }
 };
-export function __getcm__ (self, func, quotedFuncName) {
-    if (self.hasOwnProperty ('__class__')) {
+export function __getcm__ (aThis, func, quotedFuncName) {
+    if (aThis.hasOwnProperty ('__class__')) {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self.__class__] .concat (args));
+            return func.apply (null, [aThis.__class__] .concat (args));
         };
     }
     else {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self] .concat (args));
+            return func.apply (null, [aThis] .concat (args));
         };
     }
 };
-export function __getsm__ (self, func, quotedFuncName) {
+export function __getsm__ (aThis, func, quotedFuncName) {
     return func;
 };
 export var py_metatype = {
@@ -95,6 +94,9 @@ export var py_metatype = {
             var base = bases [index];
             for (var attrib in base) {
                 var descrip = Object.getOwnPropertyDescriptor (base, attrib);
+                if (descrip == null) {
+                    continue;
+                }
                 Object.defineProperty (cls, attrib, descrip);
             }
             for (let symbol of Object.getOwnPropertySymbols (base)) {
@@ -125,7 +127,7 @@ export var object = {
     __new__: function (args) {
         var instance = Object.create (this, {__class__: {value: this, enumerable: true}});
         if ('__getattr__' in this || '__setattr__' in this) {
-            instance = new Proxy (instance, {
+            instance.__proxy__ = new Proxy (instance, {
                 get: function (target, name) {
                     let result = target [name];
                     if (result == undefined) {
@@ -145,6 +147,7 @@ export var object = {
                     return true;
                 }
             })
+			instance = instance.__proxy__
         }
         this.__init__.apply (null, [instance] .concat (args));
         return instance;
@@ -1830,10 +1833,13 @@ export var Exception =  __class__ ('Exception', [BaseException], {
 			var args = tuple ();
 		}
 		self.__args__ = args;
-		try {
+		if (kwargs.error != null) {
 			self.stack = kwargs.error.stack;
 		}
-		catch (__except0__) {
+		else if (Error) {
+			self.stack = new Error ().stack;
+		}
+		else {
 			self.stack = 'No stack trace available';
 		}
 	});},
diff --git a/docs/examples/transcrypt/sketch_005/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_005/target/org.transcrypt.__runtime__.py
index 87834491..8b06f7ba 100644
--- a/docs/examples/transcrypt/sketch_005/target/org.transcrypt.__runtime__.py
+++ b/docs/examples/transcrypt/sketch_005/target/org.transcrypt.__runtime__.py
@@ -19,9 +19,11 @@ class Exception (BaseException):
     #__pragma__ ('kwargs')
     def __init__ (self, *args, **kwargs):
         self.__args__ = args
-        try:
+        if kwargs.error != None:
             self.stack = kwargs.error.stack # Integrate with JavaScript Error object
-        except:
+        elif Error:
+            self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one
+        else:
             self.stack = 'No stack trace available'
     #__pragma__ ('nokwargs')
         
diff --git a/docs/examples/transcrypt/sketch_005/target/pyp5js.js b/docs/examples/transcrypt/sketch_005/target/pyp5js.js
index 6d6a26be..6ce11a86 100644
--- a/docs/examples/transcrypt/sketch_005/target/pyp5js.js
+++ b/docs/examples/transcrypt/sketch_005/target/pyp5js.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:35
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:21
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
 import {PythonFunctions} from './python_functions.js';
 var __name__ = 'pyp5js';
 export var _P5_INSTANCE = null;
diff --git a/docs/examples/transcrypt/sketch_005/target/python_functions.js b/docs/examples/transcrypt/sketch_005/target/python_functions.js
index 3921fc73..6958e35e 100644
--- a/docs/examples/transcrypt/sketch_005/target/python_functions.js
+++ b/docs/examples/transcrypt/sketch_005/target/python_functions.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:35
-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';
+// Transcrypt'ed from Python, 2021-10-14 12:26:22
+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';
 var __name__ = 'python_functions';
 export var PythonFunctions =  __class__ ('PythonFunctions', [object], {
 	__module__: __name__,
diff --git a/docs/examples/transcrypt/sketch_005/target/sketch_005.js b/docs/examples/transcrypt/sketch_005/target/sketch_005.js
deleted file mode 100644
index 08a0cb5c..00000000
--- a/docs/examples/transcrypt/sketch_005/target/sketch_005.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:36
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-var __name__ = 'sketch_005';
-export var setup = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	createCanvas (600, 600);
-	noStroke ();
-	rectMode (CENTER);
-};
-export var draw = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	colorMode (HSB, 100);
-	var h = map (mouseY, 0, 600, 0, 100);
-	background (h, 100, 100);
-	fill (100 - h, 100, 100);
-	rect (300, 300, mouseX + 1, mouseX + 1);
-};
-
-//# sourceMappingURL=sketch_005.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_005/target/sketch_005.py b/docs/examples/transcrypt/sketch_005/target/sketch_005.py
deleted file mode 100644
index 2dfca4be..00000000
--- a/docs/examples/transcrypt/sketch_005/target/sketch_005.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from pyp5js import *
-
-
-def setup():
-    createCanvas(600,600)
-    noStroke()
-    rectMode(CENTER)
-
-
-def draw():
-    colorMode(HSB,100)
-    h = map(mouseY,0,600,0,100)
-    background(h,100,100)
-    fill(100-h,100,100)
-    rect(300,300,mouseX+1,mouseX+1)
diff --git a/docs/examples/transcrypt/sketch_005/target/target_sketch.js b/docs/examples/transcrypt/sketch_005/target/target_sketch.js
index 6d17df34..a575c641 100644
--- a/docs/examples/transcrypt/sketch_005/target/target_sketch.js
+++ b/docs/examples/transcrypt/sketch_005/target/target_sketch.js
@@ -1,9 +1,83 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:35
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-import * as source_sketch from './sketch_005.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:21
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
 var __name__ = '__main__';
-export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]);
-start_p5 (source_sketch.setup, source_sketch.draw, event_functions);
+export var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var deviceMoved = null;
+export var deviceTurned = null;
+export var deviceShaken = null;
+export var keyPressed = null;
+export var keyReleased = null;
+export var keyTyped = null;
+export var mouseMoved = null;
+export var mouseDragged = null;
+export var mousePressed = null;
+export var mouseReleased = null;
+export var mouseClicked = null;
+export var doubleClicked = null;
+export var mouseWheel = null;
+export var touchStarted = null;
+export var touchMoved = null;
+export var touchEnded = null;
+export var windowResized = null;
+var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	createCanvas (600, 600);
+	noStroke ();
+	rectMode (CENTER);
+};
+var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	colorMode (HSB, 100);
+	var h = map (mouseY, 0, 600, 0, 100);
+	background (h, 100, 100);
+	fill (100 - h, 100, 100);
+	rect (300, 300, mouseX + 1, mouseX + 1);
+};
+export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized});
+start_p5 (setup, draw, event_functions);
 
 //# sourceMappingURL=target_sketch.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_005/target/target_sketch.project b/docs/examples/transcrypt/sketch_005/target/target_sketch.project
index c101292d..e0bfda90 100644
--- a/docs/examples/transcrypt/sketch_005/target/target_sketch.project
+++ b/docs/examples/transcrypt/sketch_005/target/target_sketch.project
@@ -1 +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, "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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_005/sketch_005.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_005/__target__/sketch_005.js"}]}
\ No newline at end of file
+{"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.9/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"}]}
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_005/target/target_sketch.py b/docs/examples/transcrypt/sketch_005/target/target_sketch.py
index b0eb7670..c0de17b6 100644
--- a/docs/examples/transcrypt/sketch_005/target/target_sketch.py
+++ b/docs/examples/transcrypt/sketch_005/target/target_sketch.py
@@ -1,24 +1,63 @@
-import sketch_005 as source_sketch
 from pyp5js import *
 
+def setup():
+    pass
+
+def draw():
+    pass
+
+deviceMoved = None
+deviceTurned = None
+deviceShaken = None
+keyPressed = None
+keyReleased = None
+keyTyped = None
+mouseMoved = None
+mouseDragged = None
+mousePressed = None
+mouseReleased = None
+mouseClicked = None
+doubleClicked = None
+mouseWheel = None
+touchStarted = None
+touchMoved = None
+touchEnded = None
+windowResized = None
+
+
+def setup():
+    createCanvas(600,600)
+    noStroke()
+    rectMode(CENTER)
+
+
+def draw():
+    colorMode(HSB,100)
+    h = map(mouseY,0,600,0,100)
+    background(h,100,100)
+    fill(100-h,100,100)
+    rect(300,300,mouseX+1,mouseX+1)
+
+
+
 event_functions = {
-    "deviceMoved": source_sketch.deviceMoved,
-    "deviceTurned": source_sketch.deviceTurned,
-    "deviceShaken": source_sketch.deviceShaken,
-    "keyPressed": source_sketch.keyPressed,
-    "keyReleased": source_sketch.keyReleased,
-    "keyTyped": source_sketch.keyTyped,
-    "mouseMoved": source_sketch.mouseMoved,
-    "mouseDragged": source_sketch.mouseDragged,
-    "mousePressed": source_sketch.mousePressed,
-    "mouseReleased": source_sketch.mouseReleased,
-    "mouseClicked": source_sketch.mouseClicked,
-    "doubleClicked": source_sketch.doubleClicked,
-    "mouseWheel": source_sketch.mouseWheel,
-    "touchStarted": source_sketch.touchStarted,
-    "touchMoved": source_sketch.touchMoved,
-    "touchEnded": source_sketch.touchEnded,
-    "windowResized": source_sketch.windowResized,
+    "deviceMoved": deviceMoved,
+    "deviceTurned": deviceTurned,
+    "deviceShaken": deviceShaken,
+    "keyPressed": keyPressed,
+    "keyReleased": keyReleased,
+    "keyTyped": keyTyped,
+    "mouseMoved": mouseMoved,
+    "mouseDragged": mouseDragged,
+    "mousePressed": mousePressed,
+    "mouseReleased": mouseReleased,
+    "mouseClicked": mouseClicked,
+    "doubleClicked": doubleClicked,
+    "mouseWheel": mouseWheel,
+    "touchStarted": touchStarted,
+    "touchMoved": touchMoved,
+    "touchEnded": touchEnded,
+    "windowResized": windowResized,
 }
 
-start_p5(source_sketch.setup, source_sketch.draw, event_functions)
\ No newline at end of file
+start_p5(setup, draw, event_functions)
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_006/index.html b/docs/examples/transcrypt/sketch_006/index.html
index 4a5b9153..37e62842 100644
--- a/docs/examples/transcrypt/sketch_006/index.html
+++ b/docs/examples/transcrypt/sketch_006/index.html
@@ -47,8 +47,6 @@
         
              
-from pyp5js import *
-
 r = None
 def setup():
     global r
diff --git a/docs/examples/transcrypt/sketch_006/sketch_006.py b/docs/examples/transcrypt/sketch_006/sketch_006.py
index c005162a..ca879b0e 100644
--- a/docs/examples/transcrypt/sketch_006/sketch_006.py
+++ b/docs/examples/transcrypt/sketch_006/sketch_006.py
@@ -1,5 +1,3 @@
-from pyp5js import *
-
 r = None
 def setup():
     global r
diff --git a/docs/examples/transcrypt/sketch_006/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_006/target/org.transcrypt.__runtime__.js
index d9572b6e..533516c6 100644
--- a/docs/examples/transcrypt/sketch_006/target/org.transcrypt.__runtime__.js
+++ b/docs/examples/transcrypt/sketch_006/target/org.transcrypt.__runtime__.js
@@ -1,10 +1,10 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:36
+// Transcrypt'ed from Python, 2021-10-14 12:26:23
 var __name__ = 'org.transcrypt.__runtime__';
 export var __envir__ = {};
 __envir__.interpreter_name = 'python';
 __envir__.transpiler_name = 'transcrypt';
 __envir__.executor_name = __envir__.transpiler_name;
-__envir__.transpiler_version = '3.7.16';
+__envir__.transpiler_version = '3.9.0';
 
 export function __nest__ (headObject, tailNames, value) {
     var current = headObject;
@@ -38,15 +38,14 @@ export function __init__ (module) {
     }
     return module.__all__;
 };
-export var __proxy__ = false;
-export function __get__ (self, func, quotedFuncName) {
-    if (self) {
-        if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {
+export function __get__ (aThis, func, quotedFuncName) {
+    if (aThis) {
+        if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) {
             if (quotedFuncName) {
-                Object.defineProperty (self, quotedFuncName, {
+                Object.defineProperty (aThis, quotedFuncName, {
                     value: function () {
                         var args = [] .slice.apply (arguments);
-                        return func.apply (null, [self] .concat (args));
+                        return func.apply (null, [aThis] .concat (args));
                     },
                     writable: true,
                     enumerable: true,
@@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) {
             }
             return function () {
                 var args = [] .slice.apply (arguments);
-                return func.apply (null, [self] .concat (args));
+                return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args));
             };
         }
         else {
@@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) {
         return func;
     }
 };
-export function __getcm__ (self, func, quotedFuncName) {
-    if (self.hasOwnProperty ('__class__')) {
+export function __getcm__ (aThis, func, quotedFuncName) {
+    if (aThis.hasOwnProperty ('__class__')) {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self.__class__] .concat (args));
+            return func.apply (null, [aThis.__class__] .concat (args));
         };
     }
     else {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self] .concat (args));
+            return func.apply (null, [aThis] .concat (args));
         };
     }
 };
-export function __getsm__ (self, func, quotedFuncName) {
+export function __getsm__ (aThis, func, quotedFuncName) {
     return func;
 };
 export var py_metatype = {
@@ -95,6 +94,9 @@ export var py_metatype = {
             var base = bases [index];
             for (var attrib in base) {
                 var descrip = Object.getOwnPropertyDescriptor (base, attrib);
+                if (descrip == null) {
+                    continue;
+                }
                 Object.defineProperty (cls, attrib, descrip);
             }
             for (let symbol of Object.getOwnPropertySymbols (base)) {
@@ -125,7 +127,7 @@ export var object = {
     __new__: function (args) {
         var instance = Object.create (this, {__class__: {value: this, enumerable: true}});
         if ('__getattr__' in this || '__setattr__' in this) {
-            instance = new Proxy (instance, {
+            instance.__proxy__ = new Proxy (instance, {
                 get: function (target, name) {
                     let result = target [name];
                     if (result == undefined) {
@@ -145,6 +147,7 @@ export var object = {
                     return true;
                 }
             })
+			instance = instance.__proxy__
         }
         this.__init__.apply (null, [instance] .concat (args));
         return instance;
@@ -1830,10 +1833,13 @@ export var Exception =  __class__ ('Exception', [BaseException], {
 			var args = tuple ();
 		}
 		self.__args__ = args;
-		try {
+		if (kwargs.error != null) {
 			self.stack = kwargs.error.stack;
 		}
-		catch (__except0__) {
+		else if (Error) {
+			self.stack = new Error ().stack;
+		}
+		else {
 			self.stack = 'No stack trace available';
 		}
 	});},
diff --git a/docs/examples/transcrypt/sketch_006/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_006/target/org.transcrypt.__runtime__.py
index 87834491..8b06f7ba 100644
--- a/docs/examples/transcrypt/sketch_006/target/org.transcrypt.__runtime__.py
+++ b/docs/examples/transcrypt/sketch_006/target/org.transcrypt.__runtime__.py
@@ -19,9 +19,11 @@ class Exception (BaseException):
     #__pragma__ ('kwargs')
     def __init__ (self, *args, **kwargs):
         self.__args__ = args
-        try:
+        if kwargs.error != None:
             self.stack = kwargs.error.stack # Integrate with JavaScript Error object
-        except:
+        elif Error:
+            self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one
+        else:
             self.stack = 'No stack trace available'
     #__pragma__ ('nokwargs')
         
diff --git a/docs/examples/transcrypt/sketch_006/target/pyp5js.js b/docs/examples/transcrypt/sketch_006/target/pyp5js.js
index c4704f93..400d8b0e 100644
--- a/docs/examples/transcrypt/sketch_006/target/pyp5js.js
+++ b/docs/examples/transcrypt/sketch_006/target/pyp5js.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:36
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:23
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
 import {PythonFunctions} from './python_functions.js';
 var __name__ = 'pyp5js';
 export var _P5_INSTANCE = null;
diff --git a/docs/examples/transcrypt/sketch_006/target/python_functions.js b/docs/examples/transcrypt/sketch_006/target/python_functions.js
index ad6e63c9..e0b21e0c 100644
--- a/docs/examples/transcrypt/sketch_006/target/python_functions.js
+++ b/docs/examples/transcrypt/sketch_006/target/python_functions.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:37
-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';
+// Transcrypt'ed from Python, 2021-10-14 12:26:23
+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';
 var __name__ = 'python_functions';
 export var PythonFunctions =  __class__ ('PythonFunctions', [object], {
 	__module__: __name__,
diff --git a/docs/examples/transcrypt/sketch_006/target/sketch_006.js b/docs/examples/transcrypt/sketch_006/target/sketch_006.js
deleted file mode 100644
index fc0a9904..00000000
--- a/docs/examples/transcrypt/sketch_006/target/sketch_006.js
+++ /dev/null
@@ -1,69 +0,0 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:37
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-var __name__ = 'sketch_006';
-export var r = null;
-export var setup = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	createCanvas (900, 900);
-	r = random (100, 700);
-	noFill ();
-};
-export var draw = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	var __left0__ = tuple ([100, 100]);
-	var x = __left0__ [0];
-	var y = __left0__ [1];
-	rect (x, y, r, r);
-};
-export var keyPressed = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	console.log ('Key pressed event');
-	if (key == 'n') {
-		r = random (100, 700);
-		redraw ();
-	}
-};
-export var mouseDragged = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	r = random (100, 700);
-	redraw ();
-};
-
-//# sourceMappingURL=sketch_006.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_006/target/sketch_006.py b/docs/examples/transcrypt/sketch_006/target/sketch_006.py
deleted file mode 100644
index c005162a..00000000
--- a/docs/examples/transcrypt/sketch_006/target/sketch_006.py
+++ /dev/null
@@ -1,29 +0,0 @@
-from pyp5js import *
-
-r = None
-def setup():
-    global r
-
-    createCanvas(900, 900)
-    r = random(100, 700)
-    noFill()
-
-
-def draw():
-    x, y = 100, 100
-    rect(x, y, r, r)
-
-
-def keyPressed():
-    console.log("Key pressed event")
-
-    if key == "n":
-        global r
-        r = random(100, 700)
-        redraw()
-
-
-def mouseDragged():
-    global r
-    r = random(100, 700)
-    redraw()
diff --git a/docs/examples/transcrypt/sketch_006/target/target_sketch.js b/docs/examples/transcrypt/sketch_006/target/target_sketch.js
index 6338f40d..b5012e2e 100644
--- a/docs/examples/transcrypt/sketch_006/target/target_sketch.js
+++ b/docs/examples/transcrypt/sketch_006/target/target_sketch.js
@@ -1,9 +1,114 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:36
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-import * as source_sketch from './sketch_006.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:23
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
 var __name__ = '__main__';
-export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]);
-start_p5 (source_sketch.setup, source_sketch.draw, event_functions);
+export var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var deviceMoved = null;
+export var deviceTurned = null;
+export var deviceShaken = null;
+export var keyPressed = null;
+export var keyReleased = null;
+export var keyTyped = null;
+export var mouseMoved = null;
+export var mouseDragged = null;
+export var mousePressed = null;
+export var mouseReleased = null;
+export var mouseClicked = null;
+export var doubleClicked = null;
+export var mouseWheel = null;
+export var touchStarted = null;
+export var touchMoved = null;
+export var touchEnded = null;
+export var windowResized = null;
+export var r = null;
+var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	createCanvas (900, 900);
+	r = random (100, 700);
+	noFill ();
+};
+var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	var __left0__ = tuple ([100, 100]);
+	var x = __left0__ [0];
+	var y = __left0__ [1];
+	rect (x, y, r, r);
+};
+var keyPressed = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	console.log ('Key pressed event');
+	if (key == 'n') {
+		r = random (100, 700);
+		redraw ();
+	}
+};
+var mouseDragged = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	r = random (100, 700);
+	redraw ();
+};
+export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized});
+start_p5 (setup, draw, event_functions);
 
 //# sourceMappingURL=target_sketch.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_006/target/target_sketch.project b/docs/examples/transcrypt/sketch_006/target/target_sketch.project
index 4ac50409..f34743f4 100644
--- a/docs/examples/transcrypt/sketch_006/target/target_sketch.project
+++ b/docs/examples/transcrypt/sketch_006/target/target_sketch.project
@@ -1 +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, "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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_006/sketch_006.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_006/__target__/sketch_006.js"}]}
\ No newline at end of file
+{"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.9/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"}]}
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_006/target/target_sketch.py b/docs/examples/transcrypt/sketch_006/target/target_sketch.py
index b504e993..c8a9948c 100644
--- a/docs/examples/transcrypt/sketch_006/target/target_sketch.py
+++ b/docs/examples/transcrypt/sketch_006/target/target_sketch.py
@@ -1,24 +1,78 @@
-import sketch_006 as source_sketch
 from pyp5js import *
 
+def setup():
+    pass
+
+def draw():
+    pass
+
+deviceMoved = None
+deviceTurned = None
+deviceShaken = None
+keyPressed = None
+keyReleased = None
+keyTyped = None
+mouseMoved = None
+mouseDragged = None
+mousePressed = None
+mouseReleased = None
+mouseClicked = None
+doubleClicked = None
+mouseWheel = None
+touchStarted = None
+touchMoved = None
+touchEnded = None
+windowResized = None
+
+
+r = None
+def setup():
+    global r
+
+    createCanvas(900, 900)
+    r = random(100, 700)
+    noFill()
+
+
+def draw():
+    x, y = 100, 100
+    rect(x, y, r, r)
+
+
+def keyPressed():
+    console.log("Key pressed event")
+
+    if key == "n":
+        global r
+        r = random(100, 700)
+        redraw()
+
+
+def mouseDragged():
+    global r
+    r = random(100, 700)
+    redraw()
+
+
+
 event_functions = {
-    "deviceMoved": source_sketch.deviceMoved,
-    "deviceTurned": source_sketch.deviceTurned,
-    "deviceShaken": source_sketch.deviceShaken,
-    "keyPressed": source_sketch.keyPressed,
-    "keyReleased": source_sketch.keyReleased,
-    "keyTyped": source_sketch.keyTyped,
-    "mouseMoved": source_sketch.mouseMoved,
-    "mouseDragged": source_sketch.mouseDragged,
-    "mousePressed": source_sketch.mousePressed,
-    "mouseReleased": source_sketch.mouseReleased,
-    "mouseClicked": source_sketch.mouseClicked,
-    "doubleClicked": source_sketch.doubleClicked,
-    "mouseWheel": source_sketch.mouseWheel,
-    "touchStarted": source_sketch.touchStarted,
-    "touchMoved": source_sketch.touchMoved,
-    "touchEnded": source_sketch.touchEnded,
-    "windowResized": source_sketch.windowResized,
+    "deviceMoved": deviceMoved,
+    "deviceTurned": deviceTurned,
+    "deviceShaken": deviceShaken,
+    "keyPressed": keyPressed,
+    "keyReleased": keyReleased,
+    "keyTyped": keyTyped,
+    "mouseMoved": mouseMoved,
+    "mouseDragged": mouseDragged,
+    "mousePressed": mousePressed,
+    "mouseReleased": mouseReleased,
+    "mouseClicked": mouseClicked,
+    "doubleClicked": doubleClicked,
+    "mouseWheel": mouseWheel,
+    "touchStarted": touchStarted,
+    "touchMoved": touchMoved,
+    "touchEnded": touchEnded,
+    "windowResized": windowResized,
 }
 
-start_p5(source_sketch.setup, source_sketch.draw, event_functions)
\ No newline at end of file
+start_p5(setup, draw, event_functions)
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_007/index.html b/docs/examples/transcrypt/sketch_007/index.html
index ec8f4a4a..1d85d9bf 100644
--- a/docs/examples/transcrypt/sketch_007/index.html
+++ b/docs/examples/transcrypt/sketch_007/index.html
@@ -47,9 +47,6 @@
         
              
-from pyp5js import *
-
-
 def setup():
     createCanvas(900, 900)
     stroke(27, 27, 27, 10)
diff --git a/docs/examples/transcrypt/sketch_007/sketch_007.py b/docs/examples/transcrypt/sketch_007/sketch_007.py
index 46ddb6f8..113e7a0a 100644
--- a/docs/examples/transcrypt/sketch_007/sketch_007.py
+++ b/docs/examples/transcrypt/sketch_007/sketch_007.py
@@ -1,6 +1,3 @@
-from pyp5js import *
-
-
 def setup():
     createCanvas(900, 900)
     stroke(27, 27, 27, 10)
diff --git a/docs/examples/transcrypt/sketch_007/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_007/target/org.transcrypt.__runtime__.js
index 70161687..059ed3d7 100644
--- a/docs/examples/transcrypt/sketch_007/target/org.transcrypt.__runtime__.js
+++ b/docs/examples/transcrypt/sketch_007/target/org.transcrypt.__runtime__.js
@@ -1,10 +1,10 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:37
+// Transcrypt'ed from Python, 2021-10-14 12:26:24
 var __name__ = 'org.transcrypt.__runtime__';
 export var __envir__ = {};
 __envir__.interpreter_name = 'python';
 __envir__.transpiler_name = 'transcrypt';
 __envir__.executor_name = __envir__.transpiler_name;
-__envir__.transpiler_version = '3.7.16';
+__envir__.transpiler_version = '3.9.0';
 
 export function __nest__ (headObject, tailNames, value) {
     var current = headObject;
@@ -38,15 +38,14 @@ export function __init__ (module) {
     }
     return module.__all__;
 };
-export var __proxy__ = false;
-export function __get__ (self, func, quotedFuncName) {
-    if (self) {
-        if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {
+export function __get__ (aThis, func, quotedFuncName) {
+    if (aThis) {
+        if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) {
             if (quotedFuncName) {
-                Object.defineProperty (self, quotedFuncName, {
+                Object.defineProperty (aThis, quotedFuncName, {
                     value: function () {
                         var args = [] .slice.apply (arguments);
-                        return func.apply (null, [self] .concat (args));
+                        return func.apply (null, [aThis] .concat (args));
                     },
                     writable: true,
                     enumerable: true,
@@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) {
             }
             return function () {
                 var args = [] .slice.apply (arguments);
-                return func.apply (null, [self] .concat (args));
+                return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args));
             };
         }
         else {
@@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) {
         return func;
     }
 };
-export function __getcm__ (self, func, quotedFuncName) {
-    if (self.hasOwnProperty ('__class__')) {
+export function __getcm__ (aThis, func, quotedFuncName) {
+    if (aThis.hasOwnProperty ('__class__')) {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self.__class__] .concat (args));
+            return func.apply (null, [aThis.__class__] .concat (args));
         };
     }
     else {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self] .concat (args));
+            return func.apply (null, [aThis] .concat (args));
         };
     }
 };
-export function __getsm__ (self, func, quotedFuncName) {
+export function __getsm__ (aThis, func, quotedFuncName) {
     return func;
 };
 export var py_metatype = {
@@ -95,6 +94,9 @@ export var py_metatype = {
             var base = bases [index];
             for (var attrib in base) {
                 var descrip = Object.getOwnPropertyDescriptor (base, attrib);
+                if (descrip == null) {
+                    continue;
+                }
                 Object.defineProperty (cls, attrib, descrip);
             }
             for (let symbol of Object.getOwnPropertySymbols (base)) {
@@ -125,7 +127,7 @@ export var object = {
     __new__: function (args) {
         var instance = Object.create (this, {__class__: {value: this, enumerable: true}});
         if ('__getattr__' in this || '__setattr__' in this) {
-            instance = new Proxy (instance, {
+            instance.__proxy__ = new Proxy (instance, {
                 get: function (target, name) {
                     let result = target [name];
                     if (result == undefined) {
@@ -145,6 +147,7 @@ export var object = {
                     return true;
                 }
             })
+			instance = instance.__proxy__
         }
         this.__init__.apply (null, [instance] .concat (args));
         return instance;
@@ -1830,10 +1833,13 @@ export var Exception =  __class__ ('Exception', [BaseException], {
 			var args = tuple ();
 		}
 		self.__args__ = args;
-		try {
+		if (kwargs.error != null) {
 			self.stack = kwargs.error.stack;
 		}
-		catch (__except0__) {
+		else if (Error) {
+			self.stack = new Error ().stack;
+		}
+		else {
 			self.stack = 'No stack trace available';
 		}
 	});},
diff --git a/docs/examples/transcrypt/sketch_007/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_007/target/org.transcrypt.__runtime__.py
index 87834491..8b06f7ba 100644
--- a/docs/examples/transcrypt/sketch_007/target/org.transcrypt.__runtime__.py
+++ b/docs/examples/transcrypt/sketch_007/target/org.transcrypt.__runtime__.py
@@ -19,9 +19,11 @@ class Exception (BaseException):
     #__pragma__ ('kwargs')
     def __init__ (self, *args, **kwargs):
         self.__args__ = args
-        try:
+        if kwargs.error != None:
             self.stack = kwargs.error.stack # Integrate with JavaScript Error object
-        except:
+        elif Error:
+            self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one
+        else:
             self.stack = 'No stack trace available'
     #__pragma__ ('nokwargs')
         
diff --git a/docs/examples/transcrypt/sketch_007/target/pyp5js.js b/docs/examples/transcrypt/sketch_007/target/pyp5js.js
index 5d763a42..bf5c9330 100644
--- a/docs/examples/transcrypt/sketch_007/target/pyp5js.js
+++ b/docs/examples/transcrypt/sketch_007/target/pyp5js.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:37
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:24
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
 import {PythonFunctions} from './python_functions.js';
 var __name__ = 'pyp5js';
 export var _P5_INSTANCE = null;
diff --git a/docs/examples/transcrypt/sketch_007/target/python_functions.js b/docs/examples/transcrypt/sketch_007/target/python_functions.js
index 3b4aa04c..68a93f18 100644
--- a/docs/examples/transcrypt/sketch_007/target/python_functions.js
+++ b/docs/examples/transcrypt/sketch_007/target/python_functions.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:38
-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';
+// Transcrypt'ed from Python, 2021-10-14 12:26:25
+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';
 var __name__ = 'python_functions';
 export var PythonFunctions =  __class__ ('PythonFunctions', [object], {
 	__module__: __name__,
diff --git a/docs/examples/transcrypt/sketch_007/target/sketch_007.js b/docs/examples/transcrypt/sketch_007/target/sketch_007.js
deleted file mode 100644
index fc89ce5d..00000000
--- a/docs/examples/transcrypt/sketch_007/target/sketch_007.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:38
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-var __name__ = 'sketch_007';
-export var setup = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	createCanvas (900, 900);
-	stroke (27, 27, 27, 10);
-	strokeWeight (2);
-};
-export var draw = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	push ();
-	translate (width / 2, height / 2);
-	var v = p5.Vector.random2D ();
-	v.normalize ();
-	v.mult (random (100, 400));
-	line (0, 0, v.x, v.y);
-	py_pop ();
-};
-
-//# sourceMappingURL=sketch_007.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_007/target/sketch_007.py b/docs/examples/transcrypt/sketch_007/target/sketch_007.py
deleted file mode 100644
index 46ddb6f8..00000000
--- a/docs/examples/transcrypt/sketch_007/target/sketch_007.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from pyp5js import *
-
-
-def setup():
-    createCanvas(900, 900)
-    stroke(27, 27, 27, 10)
-    strokeWeight(2)
-
-
-def draw():
-    push()
-
-    translate(width / 2, height / 2)
-    v = p5.Vector.random2D()
-    v.normalize()
-    v.mult(random(100, 400))
-    line(0, 0, v.x, v.y)
-
-    pop()
diff --git a/docs/examples/transcrypt/sketch_007/target/target_sketch.js b/docs/examples/transcrypt/sketch_007/target/target_sketch.js
index 198779ac..680f1843 100644
--- a/docs/examples/transcrypt/sketch_007/target/target_sketch.js
+++ b/docs/examples/transcrypt/sketch_007/target/target_sketch.js
@@ -1,9 +1,85 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:37
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-import * as source_sketch from './sketch_007.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:24
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
 var __name__ = '__main__';
-export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]);
-start_p5 (source_sketch.setup, source_sketch.draw, event_functions);
+export var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var deviceMoved = null;
+export var deviceTurned = null;
+export var deviceShaken = null;
+export var keyPressed = null;
+export var keyReleased = null;
+export var keyTyped = null;
+export var mouseMoved = null;
+export var mouseDragged = null;
+export var mousePressed = null;
+export var mouseReleased = null;
+export var mouseClicked = null;
+export var doubleClicked = null;
+export var mouseWheel = null;
+export var touchStarted = null;
+export var touchMoved = null;
+export var touchEnded = null;
+export var windowResized = null;
+var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	createCanvas (900, 900);
+	stroke (27, 27, 27, 10);
+	strokeWeight (2);
+};
+var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	push ();
+	translate (width / 2, height / 2);
+	var v = p5.Vector.random2D ();
+	v.normalize ();
+	v.mult (random (100, 400));
+	line (0, 0, v.x, v.y);
+	py_pop ();
+};
+export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized});
+start_p5 (setup, draw, event_functions);
 
 //# sourceMappingURL=target_sketch.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_007/target/target_sketch.project b/docs/examples/transcrypt/sketch_007/target/target_sketch.project
index 6f1f958c..a28408fe 100644
--- a/docs/examples/transcrypt/sketch_007/target/target_sketch.project
+++ b/docs/examples/transcrypt/sketch_007/target/target_sketch.project
@@ -1 +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, "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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_007/sketch_007.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_007/__target__/sketch_007.js"}]}
\ No newline at end of file
+{"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.9/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"}]}
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_007/target/target_sketch.py b/docs/examples/transcrypt/sketch_007/target/target_sketch.py
index b78f41cd..7d1f925f 100644
--- a/docs/examples/transcrypt/sketch_007/target/target_sketch.py
+++ b/docs/examples/transcrypt/sketch_007/target/target_sketch.py
@@ -1,24 +1,67 @@
-import sketch_007 as source_sketch
 from pyp5js import *
 
+def setup():
+    pass
+
+def draw():
+    pass
+
+deviceMoved = None
+deviceTurned = None
+deviceShaken = None
+keyPressed = None
+keyReleased = None
+keyTyped = None
+mouseMoved = None
+mouseDragged = None
+mousePressed = None
+mouseReleased = None
+mouseClicked = None
+doubleClicked = None
+mouseWheel = None
+touchStarted = None
+touchMoved = None
+touchEnded = None
+windowResized = None
+
+
+def setup():
+    createCanvas(900, 900)
+    stroke(27, 27, 27, 10)
+    strokeWeight(2)
+
+
+def draw():
+    push()
+
+    translate(width / 2, height / 2)
+    v = p5.Vector.random2D()
+    v.normalize()
+    v.mult(random(100, 400))
+    line(0, 0, v.x, v.y)
+
+    pop()
+
+
+
 event_functions = {
-    "deviceMoved": source_sketch.deviceMoved,
-    "deviceTurned": source_sketch.deviceTurned,
-    "deviceShaken": source_sketch.deviceShaken,
-    "keyPressed": source_sketch.keyPressed,
-    "keyReleased": source_sketch.keyReleased,
-    "keyTyped": source_sketch.keyTyped,
-    "mouseMoved": source_sketch.mouseMoved,
-    "mouseDragged": source_sketch.mouseDragged,
-    "mousePressed": source_sketch.mousePressed,
-    "mouseReleased": source_sketch.mouseReleased,
-    "mouseClicked": source_sketch.mouseClicked,
-    "doubleClicked": source_sketch.doubleClicked,
-    "mouseWheel": source_sketch.mouseWheel,
-    "touchStarted": source_sketch.touchStarted,
-    "touchMoved": source_sketch.touchMoved,
-    "touchEnded": source_sketch.touchEnded,
-    "windowResized": source_sketch.windowResized,
+    "deviceMoved": deviceMoved,
+    "deviceTurned": deviceTurned,
+    "deviceShaken": deviceShaken,
+    "keyPressed": keyPressed,
+    "keyReleased": keyReleased,
+    "keyTyped": keyTyped,
+    "mouseMoved": mouseMoved,
+    "mouseDragged": mouseDragged,
+    "mousePressed": mousePressed,
+    "mouseReleased": mouseReleased,
+    "mouseClicked": mouseClicked,
+    "doubleClicked": doubleClicked,
+    "mouseWheel": mouseWheel,
+    "touchStarted": touchStarted,
+    "touchMoved": touchMoved,
+    "touchEnded": touchEnded,
+    "windowResized": windowResized,
 }
 
-start_p5(source_sketch.setup, source_sketch.draw, event_functions)
\ No newline at end of file
+start_p5(setup, draw, event_functions)
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_008/index.html b/docs/examples/transcrypt/sketch_008/index.html
index 7283189c..1b27ea0a 100644
--- a/docs/examples/transcrypt/sketch_008/index.html
+++ b/docs/examples/transcrypt/sketch_008/index.html
@@ -47,9 +47,6 @@
         
              
-from pyp5js import *
-
-
 rect_base_size = 30
 positions = []
 rect_size = None
diff --git a/docs/examples/transcrypt/sketch_008/sketch_008.py b/docs/examples/transcrypt/sketch_008/sketch_008.py
index e1a9b205..ee4214e4 100644
--- a/docs/examples/transcrypt/sketch_008/sketch_008.py
+++ b/docs/examples/transcrypt/sketch_008/sketch_008.py
@@ -1,6 +1,3 @@
-from pyp5js import *
-
-
 rect_base_size = 30
 positions = []
 rect_size = None
diff --git a/docs/examples/transcrypt/sketch_008/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_008/target/org.transcrypt.__runtime__.js
index 06fa4155..1b4aaa1a 100644
--- a/docs/examples/transcrypt/sketch_008/target/org.transcrypt.__runtime__.js
+++ b/docs/examples/transcrypt/sketch_008/target/org.transcrypt.__runtime__.js
@@ -1,10 +1,10 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:38
+// Transcrypt'ed from Python, 2021-10-14 12:26:25
 var __name__ = 'org.transcrypt.__runtime__';
 export var __envir__ = {};
 __envir__.interpreter_name = 'python';
 __envir__.transpiler_name = 'transcrypt';
 __envir__.executor_name = __envir__.transpiler_name;
-__envir__.transpiler_version = '3.7.16';
+__envir__.transpiler_version = '3.9.0';
 
 export function __nest__ (headObject, tailNames, value) {
     var current = headObject;
@@ -38,15 +38,14 @@ export function __init__ (module) {
     }
     return module.__all__;
 };
-export var __proxy__ = false;
-export function __get__ (self, func, quotedFuncName) {
-    if (self) {
-        if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {
+export function __get__ (aThis, func, quotedFuncName) {
+    if (aThis) {
+        if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) {
             if (quotedFuncName) {
-                Object.defineProperty (self, quotedFuncName, {
+                Object.defineProperty (aThis, quotedFuncName, {
                     value: function () {
                         var args = [] .slice.apply (arguments);
-                        return func.apply (null, [self] .concat (args));
+                        return func.apply (null, [aThis] .concat (args));
                     },
                     writable: true,
                     enumerable: true,
@@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) {
             }
             return function () {
                 var args = [] .slice.apply (arguments);
-                return func.apply (null, [self] .concat (args));
+                return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args));
             };
         }
         else {
@@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) {
         return func;
     }
 };
-export function __getcm__ (self, func, quotedFuncName) {
-    if (self.hasOwnProperty ('__class__')) {
+export function __getcm__ (aThis, func, quotedFuncName) {
+    if (aThis.hasOwnProperty ('__class__')) {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self.__class__] .concat (args));
+            return func.apply (null, [aThis.__class__] .concat (args));
         };
     }
     else {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self] .concat (args));
+            return func.apply (null, [aThis] .concat (args));
         };
     }
 };
-export function __getsm__ (self, func, quotedFuncName) {
+export function __getsm__ (aThis, func, quotedFuncName) {
     return func;
 };
 export var py_metatype = {
@@ -95,6 +94,9 @@ export var py_metatype = {
             var base = bases [index];
             for (var attrib in base) {
                 var descrip = Object.getOwnPropertyDescriptor (base, attrib);
+                if (descrip == null) {
+                    continue;
+                }
                 Object.defineProperty (cls, attrib, descrip);
             }
             for (let symbol of Object.getOwnPropertySymbols (base)) {
@@ -125,7 +127,7 @@ export var object = {
     __new__: function (args) {
         var instance = Object.create (this, {__class__: {value: this, enumerable: true}});
         if ('__getattr__' in this || '__setattr__' in this) {
-            instance = new Proxy (instance, {
+            instance.__proxy__ = new Proxy (instance, {
                 get: function (target, name) {
                     let result = target [name];
                     if (result == undefined) {
@@ -145,6 +147,7 @@ export var object = {
                     return true;
                 }
             })
+			instance = instance.__proxy__
         }
         this.__init__.apply (null, [instance] .concat (args));
         return instance;
@@ -1830,10 +1833,13 @@ export var Exception =  __class__ ('Exception', [BaseException], {
 			var args = tuple ();
 		}
 		self.__args__ = args;
-		try {
+		if (kwargs.error != null) {
 			self.stack = kwargs.error.stack;
 		}
-		catch (__except0__) {
+		else if (Error) {
+			self.stack = new Error ().stack;
+		}
+		else {
 			self.stack = 'No stack trace available';
 		}
 	});},
diff --git a/docs/examples/transcrypt/sketch_008/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_008/target/org.transcrypt.__runtime__.py
index 87834491..8b06f7ba 100644
--- a/docs/examples/transcrypt/sketch_008/target/org.transcrypt.__runtime__.py
+++ b/docs/examples/transcrypt/sketch_008/target/org.transcrypt.__runtime__.py
@@ -19,9 +19,11 @@ class Exception (BaseException):
     #__pragma__ ('kwargs')
     def __init__ (self, *args, **kwargs):
         self.__args__ = args
-        try:
+        if kwargs.error != None:
             self.stack = kwargs.error.stack # Integrate with JavaScript Error object
-        except:
+        elif Error:
+            self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one
+        else:
             self.stack = 'No stack trace available'
     #__pragma__ ('nokwargs')
         
diff --git a/docs/examples/transcrypt/sketch_008/target/pyp5js.js b/docs/examples/transcrypt/sketch_008/target/pyp5js.js
index 6d7c0a79..b994eda8 100644
--- a/docs/examples/transcrypt/sketch_008/target/pyp5js.js
+++ b/docs/examples/transcrypt/sketch_008/target/pyp5js.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:39
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:26
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
 import {PythonFunctions} from './python_functions.js';
 var __name__ = 'pyp5js';
 export var _P5_INSTANCE = null;
diff --git a/docs/examples/transcrypt/sketch_008/target/python_functions.js b/docs/examples/transcrypt/sketch_008/target/python_functions.js
index d94881f7..24133b19 100644
--- a/docs/examples/transcrypt/sketch_008/target/python_functions.js
+++ b/docs/examples/transcrypt/sketch_008/target/python_functions.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:39
-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';
+// Transcrypt'ed from Python, 2021-10-14 12:26:26
+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';
 var __name__ = 'python_functions';
 export var PythonFunctions =  __class__ ('PythonFunctions', [object], {
 	__module__: __name__,
diff --git a/docs/examples/transcrypt/sketch_008/target/sketch_008.js b/docs/examples/transcrypt/sketch_008/target/sketch_008.js
deleted file mode 100644
index 73fd9c1f..00000000
--- a/docs/examples/transcrypt/sketch_008/target/sketch_008.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:39
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-var __name__ = 'sketch_008';
-export var rect_base_size = 30;
-export var positions = [];
-export var rect_size = null;
-export var setup = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	createP ('Hi! This is an example of how to use p5.dom.js with pyp5js');
-	var slider_div = createDiv ();
-	slider_div.style ('display', 'block');
-	rect_size = createSlider (0, 600, 100);
-	rect_size.style ('width', '50%');
-	slider_div.child (rect_size);
-	createCanvas (600, 600);
-	for (var x of range (-(rect_base_size), width + rect_base_size, rect_base_size)) {
-		for (var y of range (-(rect_base_size), height + rect_base_size, rect_base_size)) {
-			positions.append (tuple ([x, y]));
-		}
-	}
-	noFill ();
-	strokeWeight (2);
-	rectMode (CENTER);
-};
-export var draw = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	background (255);
-	var size = rect_size.value ();
-	for (var [x, y] of positions) {
-		rect (x, y, size, size);
-	}
-};
-
-//# sourceMappingURL=sketch_008.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_008/target/sketch_008.py b/docs/examples/transcrypt/sketch_008/target/sketch_008.py
deleted file mode 100644
index e1a9b205..00000000
--- a/docs/examples/transcrypt/sketch_008/target/sketch_008.py
+++ /dev/null
@@ -1,39 +0,0 @@
-from pyp5js import *
-
-
-rect_base_size = 30
-positions = []
-rect_size = None
-
-def setup():
-    global rect_size
-
-    createP("Hi! This is an example of how to use p5.dom.js with pyp5js")
-
-    # creates a container div
-    slider_div = createDiv()
-    slider_div.style("display", "block")
-
-    # creates the slider
-    rect_size = createSlider(0, 600, 100)
-    rect_size.style('width', '50%')
-
-    # adds the slider to the container div
-    slider_div.child(rect_size)
-
-    createCanvas(600, 600)
-
-    for x in range(-rect_base_size, width + rect_base_size, rect_base_size):
-        for y in range(-rect_base_size, height + rect_base_size, rect_base_size):
-            positions.append((x, y))
-
-    noFill()
-    strokeWeight(2)
-    rectMode(CENTER)
-
-
-def draw():
-    background(255)
-    size = rect_size.value()
-    for x, y in positions:
-        rect(x, y, size, size)
diff --git a/docs/examples/transcrypt/sketch_008/target/target_sketch.js b/docs/examples/transcrypt/sketch_008/target/target_sketch.js
index 791a68b0..6d27bbb9 100644
--- a/docs/examples/transcrypt/sketch_008/target/target_sketch.js
+++ b/docs/examples/transcrypt/sketch_008/target/target_sketch.js
@@ -1,9 +1,98 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:38
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-import * as source_sketch from './sketch_008.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:26
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
 var __name__ = '__main__';
-export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]);
-start_p5 (source_sketch.setup, source_sketch.draw, event_functions);
+export var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var deviceMoved = null;
+export var deviceTurned = null;
+export var deviceShaken = null;
+export var keyPressed = null;
+export var keyReleased = null;
+export var keyTyped = null;
+export var mouseMoved = null;
+export var mouseDragged = null;
+export var mousePressed = null;
+export var mouseReleased = null;
+export var mouseClicked = null;
+export var doubleClicked = null;
+export var mouseWheel = null;
+export var touchStarted = null;
+export var touchMoved = null;
+export var touchEnded = null;
+export var windowResized = null;
+export var rect_base_size = 30;
+export var positions = [];
+export var rect_size = null;
+var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	createP ('Hi! This is an example of how to use p5.dom.js with pyp5js');
+	var slider_div = createDiv ();
+	slider_div.style ('display', 'block');
+	rect_size = createSlider (0, 600, 100);
+	rect_size.style ('width', '50%');
+	slider_div.child (rect_size);
+	createCanvas (600, 600);
+	for (var x of range (-(rect_base_size), width + rect_base_size, rect_base_size)) {
+		for (var y of range (-(rect_base_size), height + rect_base_size, rect_base_size)) {
+			positions.append (tuple ([x, y]));
+		}
+	}
+	noFill ();
+	strokeWeight (2);
+	rectMode (CENTER);
+};
+var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	background (255);
+	var size = rect_size.value ();
+	for (var [x, y] of positions) {
+		rect (x, y, size, size);
+	}
+};
+export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized});
+start_p5 (setup, draw, event_functions);
 
 //# sourceMappingURL=target_sketch.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_008/target/target_sketch.project b/docs/examples/transcrypt/sketch_008/target/target_sketch.project
index cac3d7ee..2e547690 100644
--- a/docs/examples/transcrypt/sketch_008/target/target_sketch.project
+++ b/docs/examples/transcrypt/sketch_008/target/target_sketch.project
@@ -1 +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, "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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_008/sketch_008.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_008/__target__/sketch_008.js"}]}
\ No newline at end of file
+{"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.9/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"}]}
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_008/target/target_sketch.py b/docs/examples/transcrypt/sketch_008/target/target_sketch.py
index 12da28d0..9ca7cbbb 100644
--- a/docs/examples/transcrypt/sketch_008/target/target_sketch.py
+++ b/docs/examples/transcrypt/sketch_008/target/target_sketch.py
@@ -1,24 +1,87 @@
-import sketch_008 as source_sketch
 from pyp5js import *
 
+def setup():
+    pass
+
+def draw():
+    pass
+
+deviceMoved = None
+deviceTurned = None
+deviceShaken = None
+keyPressed = None
+keyReleased = None
+keyTyped = None
+mouseMoved = None
+mouseDragged = None
+mousePressed = None
+mouseReleased = None
+mouseClicked = None
+doubleClicked = None
+mouseWheel = None
+touchStarted = None
+touchMoved = None
+touchEnded = None
+windowResized = None
+
+
+rect_base_size = 30
+positions = []
+rect_size = None
+
+def setup():
+    global rect_size
+
+    createP("Hi! This is an example of how to use p5.dom.js with pyp5js")
+
+    # creates a container div
+    slider_div = createDiv()
+    slider_div.style("display", "block")
+
+    # creates the slider
+    rect_size = createSlider(0, 600, 100)
+    rect_size.style('width', '50%')
+
+    # adds the slider to the container div
+    slider_div.child(rect_size)
+
+    createCanvas(600, 600)
+
+    for x in range(-rect_base_size, width + rect_base_size, rect_base_size):
+        for y in range(-rect_base_size, height + rect_base_size, rect_base_size):
+            positions.append((x, y))
+
+    noFill()
+    strokeWeight(2)
+    rectMode(CENTER)
+
+
+def draw():
+    background(255)
+    size = rect_size.value()
+    for x, y in positions:
+        rect(x, y, size, size)
+
+
+
 event_functions = {
-    "deviceMoved": source_sketch.deviceMoved,
-    "deviceTurned": source_sketch.deviceTurned,
-    "deviceShaken": source_sketch.deviceShaken,
-    "keyPressed": source_sketch.keyPressed,
-    "keyReleased": source_sketch.keyReleased,
-    "keyTyped": source_sketch.keyTyped,
-    "mouseMoved": source_sketch.mouseMoved,
-    "mouseDragged": source_sketch.mouseDragged,
-    "mousePressed": source_sketch.mousePressed,
-    "mouseReleased": source_sketch.mouseReleased,
-    "mouseClicked": source_sketch.mouseClicked,
-    "doubleClicked": source_sketch.doubleClicked,
-    "mouseWheel": source_sketch.mouseWheel,
-    "touchStarted": source_sketch.touchStarted,
-    "touchMoved": source_sketch.touchMoved,
-    "touchEnded": source_sketch.touchEnded,
-    "windowResized": source_sketch.windowResized,
+    "deviceMoved": deviceMoved,
+    "deviceTurned": deviceTurned,
+    "deviceShaken": deviceShaken,
+    "keyPressed": keyPressed,
+    "keyReleased": keyReleased,
+    "keyTyped": keyTyped,
+    "mouseMoved": mouseMoved,
+    "mouseDragged": mouseDragged,
+    "mousePressed": mousePressed,
+    "mouseReleased": mouseReleased,
+    "mouseClicked": mouseClicked,
+    "doubleClicked": doubleClicked,
+    "mouseWheel": mouseWheel,
+    "touchStarted": touchStarted,
+    "touchMoved": touchMoved,
+    "touchEnded": touchEnded,
+    "windowResized": windowResized,
 }
 
-start_p5(source_sketch.setup, source_sketch.draw, event_functions)
\ No newline at end of file
+start_p5(setup, draw, event_functions)
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_009/index.html b/docs/examples/transcrypt/sketch_009/index.html
index b32970ae..86a9f9d0 100644
--- a/docs/examples/transcrypt/sketch_009/index.html
+++ b/docs/examples/transcrypt/sketch_009/index.html
@@ -47,8 +47,6 @@
         
              
-from pyp5js import *
-
 from random import choice
 
 
diff --git a/docs/examples/transcrypt/sketch_009/sketch_009.py b/docs/examples/transcrypt/sketch_009/sketch_009.py
index c9dd4736..c9388d7c 100644
--- a/docs/examples/transcrypt/sketch_009/sketch_009.py
+++ b/docs/examples/transcrypt/sketch_009/sketch_009.py
@@ -1,5 +1,3 @@
-from pyp5js import *
-
 from random import choice
 
 
diff --git a/docs/examples/transcrypt/sketch_009/target/math.js b/docs/examples/transcrypt/sketch_009/target/math.js
index e1572c2e..0c621bdc 100644
--- a/docs/examples/transcrypt/sketch_009/target/math.js
+++ b/docs/examples/transcrypt/sketch_009/target/math.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:40
-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, 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';
+// Transcrypt'ed from Python, 2021-10-14 12:26:27
+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, 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';
 var __name__ = 'math';
 export var pi = Math.PI;
 export var e = Math.E;
diff --git a/docs/examples/transcrypt/sketch_009/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_009/target/org.transcrypt.__runtime__.js
index eb712672..87791797 100644
--- a/docs/examples/transcrypt/sketch_009/target/org.transcrypt.__runtime__.js
+++ b/docs/examples/transcrypt/sketch_009/target/org.transcrypt.__runtime__.js
@@ -1,10 +1,10 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:40
+// Transcrypt'ed from Python, 2021-10-14 12:26:27
 var __name__ = 'org.transcrypt.__runtime__';
 export var __envir__ = {};
 __envir__.interpreter_name = 'python';
 __envir__.transpiler_name = 'transcrypt';
 __envir__.executor_name = __envir__.transpiler_name;
-__envir__.transpiler_version = '3.7.16';
+__envir__.transpiler_version = '3.9.0';
 
 export function __nest__ (headObject, tailNames, value) {
     var current = headObject;
@@ -38,15 +38,14 @@ export function __init__ (module) {
     }
     return module.__all__;
 };
-export var __proxy__ = false;
-export function __get__ (self, func, quotedFuncName) {
-    if (self) {
-        if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {
+export function __get__ (aThis, func, quotedFuncName) {
+    if (aThis) {
+        if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) {
             if (quotedFuncName) {
-                Object.defineProperty (self, quotedFuncName, {
+                Object.defineProperty (aThis, quotedFuncName, {
                     value: function () {
                         var args = [] .slice.apply (arguments);
-                        return func.apply (null, [self] .concat (args));
+                        return func.apply (null, [aThis] .concat (args));
                     },
                     writable: true,
                     enumerable: true,
@@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) {
             }
             return function () {
                 var args = [] .slice.apply (arguments);
-                return func.apply (null, [self] .concat (args));
+                return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args));
             };
         }
         else {
@@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) {
         return func;
     }
 };
-export function __getcm__ (self, func, quotedFuncName) {
-    if (self.hasOwnProperty ('__class__')) {
+export function __getcm__ (aThis, func, quotedFuncName) {
+    if (aThis.hasOwnProperty ('__class__')) {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self.__class__] .concat (args));
+            return func.apply (null, [aThis.__class__] .concat (args));
         };
     }
     else {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self] .concat (args));
+            return func.apply (null, [aThis] .concat (args));
         };
     }
 };
-export function __getsm__ (self, func, quotedFuncName) {
+export function __getsm__ (aThis, func, quotedFuncName) {
     return func;
 };
 export var py_metatype = {
@@ -95,6 +94,9 @@ export var py_metatype = {
             var base = bases [index];
             for (var attrib in base) {
                 var descrip = Object.getOwnPropertyDescriptor (base, attrib);
+                if (descrip == null) {
+                    continue;
+                }
                 Object.defineProperty (cls, attrib, descrip);
             }
             for (let symbol of Object.getOwnPropertySymbols (base)) {
@@ -125,7 +127,7 @@ export var object = {
     __new__: function (args) {
         var instance = Object.create (this, {__class__: {value: this, enumerable: true}});
         if ('__getattr__' in this || '__setattr__' in this) {
-            instance = new Proxy (instance, {
+            instance.__proxy__ = new Proxy (instance, {
                 get: function (target, name) {
                     let result = target [name];
                     if (result == undefined) {
@@ -145,6 +147,7 @@ export var object = {
                     return true;
                 }
             })
+			instance = instance.__proxy__
         }
         this.__init__.apply (null, [instance] .concat (args));
         return instance;
@@ -1830,10 +1833,13 @@ export var Exception =  __class__ ('Exception', [BaseException], {
 			var args = tuple ();
 		}
 		self.__args__ = args;
-		try {
+		if (kwargs.error != null) {
 			self.stack = kwargs.error.stack;
 		}
-		catch (__except0__) {
+		else if (Error) {
+			self.stack = new Error ().stack;
+		}
+		else {
 			self.stack = 'No stack trace available';
 		}
 	});},
diff --git a/docs/examples/transcrypt/sketch_009/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_009/target/org.transcrypt.__runtime__.py
index 87834491..8b06f7ba 100644
--- a/docs/examples/transcrypt/sketch_009/target/org.transcrypt.__runtime__.py
+++ b/docs/examples/transcrypt/sketch_009/target/org.transcrypt.__runtime__.py
@@ -19,9 +19,11 @@ class Exception (BaseException):
     #__pragma__ ('kwargs')
     def __init__ (self, *args, **kwargs):
         self.__args__ = args
-        try:
+        if kwargs.error != None:
             self.stack = kwargs.error.stack # Integrate with JavaScript Error object
-        except:
+        elif Error:
+            self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one
+        else:
             self.stack = 'No stack trace available'
     #__pragma__ ('nokwargs')
         
diff --git a/docs/examples/transcrypt/sketch_009/target/pyp5js.js b/docs/examples/transcrypt/sketch_009/target/pyp5js.js
index f3e74eaa..258c3377 100644
--- a/docs/examples/transcrypt/sketch_009/target/pyp5js.js
+++ b/docs/examples/transcrypt/sketch_009/target/pyp5js.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:40
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:27
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
 import {PythonFunctions} from './python_functions.js';
 var __name__ = 'pyp5js';
 export var _P5_INSTANCE = null;
diff --git a/docs/examples/transcrypt/sketch_009/target/python_functions.js b/docs/examples/transcrypt/sketch_009/target/python_functions.js
index be0ab1c4..ac0c8407 100644
--- a/docs/examples/transcrypt/sketch_009/target/python_functions.js
+++ b/docs/examples/transcrypt/sketch_009/target/python_functions.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:40
-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';
+// Transcrypt'ed from Python, 2021-10-14 12:26:28
+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';
 var __name__ = 'python_functions';
 export var PythonFunctions =  __class__ ('PythonFunctions', [object], {
 	__module__: __name__,
diff --git a/docs/examples/transcrypt/sketch_009/target/random.js b/docs/examples/transcrypt/sketch_009/target/random.js
index d24ee9e8..debb6584 100644
--- a/docs/examples/transcrypt/sketch_009/target/random.js
+++ b/docs/examples/transcrypt/sketch_009/target/random.js
@@ -1,6 +1,6 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:40
+// Transcrypt'ed from Python, 2021-10-14 12:26:27
 var math = {};
-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';
+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';
 import * as __module_math__ from './math.js';
 __nest__ (math, '', __module_math__);
 var __name__ = 'random';
@@ -138,7 +138,7 @@ export var shuffle = function (x) {
 	}
 	else {
 	}
-	for (var i of range (len (x) - 1, 0, -(1))) {
+	for (var i = len (x) - 1; i > 0; i--) {
 		var j = math.floor (random () * (i + 1));
 		var temp = x [i];
 		x [i] = x [j];
diff --git a/docs/examples/transcrypt/sketch_009/target/sketch_009.js b/docs/examples/transcrypt/sketch_009/target/sketch_009.js
deleted file mode 100644
index c6e22fdc..00000000
--- a/docs/examples/transcrypt/sketch_009/target/sketch_009.js
+++ /dev/null
@@ -1,54 +0,0 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:40
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {choice} from './random.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-var __name__ = 'sketch_009';
-export var images = [];
-export var setup = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	createP ('Click to add a new image');
-	createCanvas (600, 600);
-	background (200);
-	images = [loadImage ('smile.png'), loadImage ('alien.png'), loadImage ('rainbow.png')];
-};
-export var mousePressed = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	var __left0__ = tuple ([mouseX, mouseY]);
-	var x = __left0__ [0];
-	var y = __left0__ [1];
-	var img = choice (images);
-	image (img, x, y);
-};
-export var draw = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	// pass;
-};
-
-//# sourceMappingURL=sketch_009.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_009/target/sketch_009.py b/docs/examples/transcrypt/sketch_009/target/sketch_009.py
deleted file mode 100644
index c9dd4736..00000000
--- a/docs/examples/transcrypt/sketch_009/target/sketch_009.py
+++ /dev/null
@@ -1,28 +0,0 @@
-from pyp5js import *
-
-from random import choice
-
-
-images = []
-
-def setup():
-    global images
-
-    createP("Click to add a new image")
-    createCanvas(600, 600)
-    background(200)
-    images = [
-        loadImage('smile.png'),
-        loadImage('alien.png'),
-        loadImage('rainbow.png'),
-    ]
-
-
-def mousePressed():
-    x, y = mouseX, mouseY
-    img = choice(images)
-    image(img, x, y)
-
-
-def draw():
-    pass
diff --git a/docs/examples/transcrypt/sketch_009/target/target_sketch.js b/docs/examples/transcrypt/sketch_009/target/target_sketch.js
index b07e9439..c13f2253 100644
--- a/docs/examples/transcrypt/sketch_009/target/target_sketch.js
+++ b/docs/examples/transcrypt/sketch_009/target/target_sketch.js
@@ -1,9 +1,99 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:40
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-import * as source_sketch from './sketch_009.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:27
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+import {choice} from './random.js';
+import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
 var __name__ = '__main__';
-export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]);
-start_p5 (source_sketch.setup, source_sketch.draw, event_functions);
+export var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var deviceMoved = null;
+export var deviceTurned = null;
+export var deviceShaken = null;
+export var keyPressed = null;
+export var keyReleased = null;
+export var keyTyped = null;
+export var mouseMoved = null;
+export var mouseDragged = null;
+export var mousePressed = null;
+export var mouseReleased = null;
+export var mouseClicked = null;
+export var doubleClicked = null;
+export var mouseWheel = null;
+export var touchStarted = null;
+export var touchMoved = null;
+export var touchEnded = null;
+export var windowResized = null;
+export var images = [];
+var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	createP ('Click to add a new image');
+	createCanvas (600, 600);
+	background (200);
+	images = [loadImage ('smile.png'), loadImage ('alien.png'), loadImage ('rainbow.png')];
+};
+var mousePressed = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	var __left0__ = tuple ([mouseX, mouseY]);
+	var x = __left0__ [0];
+	var y = __left0__ [1];
+	var img = choice (images);
+	image (img, x, y);
+};
+var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized});
+start_p5 (setup, draw, event_functions);
 
 //# sourceMappingURL=target_sketch.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_009/target/target_sketch.project b/docs/examples/transcrypt/sketch_009/target/target_sketch.project
index 6a89df12..e858342a 100644
--- a/docs/examples/transcrypt/sketch_009/target/target_sketch.project
+++ b/docs/examples/transcrypt/sketch_009/target/target_sketch.project
@@ -1 +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, "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/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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/sketch_009.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_009/__target__/sketch_009.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"}]}
\ No newline at end of file
+{"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.9/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.9/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.9/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"}]}
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_009/target/target_sketch.py b/docs/examples/transcrypt/sketch_009/target/target_sketch.py
index e7a6e442..5236322f 100644
--- a/docs/examples/transcrypt/sketch_009/target/target_sketch.py
+++ b/docs/examples/transcrypt/sketch_009/target/target_sketch.py
@@ -1,24 +1,77 @@
-import sketch_009 as source_sketch
 from pyp5js import *
 
+def setup():
+    pass
+
+def draw():
+    pass
+
+deviceMoved = None
+deviceTurned = None
+deviceShaken = None
+keyPressed = None
+keyReleased = None
+keyTyped = None
+mouseMoved = None
+mouseDragged = None
+mousePressed = None
+mouseReleased = None
+mouseClicked = None
+doubleClicked = None
+mouseWheel = None
+touchStarted = None
+touchMoved = None
+touchEnded = None
+windowResized = None
+
+
+from random import choice
+
+
+images = []
+
+def setup():
+    global images
+
+    createP("Click to add a new image")
+    createCanvas(600, 600)
+    background(200)
+    images = [
+        loadImage('smile.png'),
+        loadImage('alien.png'),
+        loadImage('rainbow.png'),
+    ]
+
+
+def mousePressed():
+    x, y = mouseX, mouseY
+    img = choice(images)
+    image(img, x, y)
+
+
+def draw():
+    pass
+
+
+
 event_functions = {
-    "deviceMoved": source_sketch.deviceMoved,
-    "deviceTurned": source_sketch.deviceTurned,
-    "deviceShaken": source_sketch.deviceShaken,
-    "keyPressed": source_sketch.keyPressed,
-    "keyReleased": source_sketch.keyReleased,
-    "keyTyped": source_sketch.keyTyped,
-    "mouseMoved": source_sketch.mouseMoved,
-    "mouseDragged": source_sketch.mouseDragged,
-    "mousePressed": source_sketch.mousePressed,
-    "mouseReleased": source_sketch.mouseReleased,
-    "mouseClicked": source_sketch.mouseClicked,
-    "doubleClicked": source_sketch.doubleClicked,
-    "mouseWheel": source_sketch.mouseWheel,
-    "touchStarted": source_sketch.touchStarted,
-    "touchMoved": source_sketch.touchMoved,
-    "touchEnded": source_sketch.touchEnded,
-    "windowResized": source_sketch.windowResized,
+    "deviceMoved": deviceMoved,
+    "deviceTurned": deviceTurned,
+    "deviceShaken": deviceShaken,
+    "keyPressed": keyPressed,
+    "keyReleased": keyReleased,
+    "keyTyped": keyTyped,
+    "mouseMoved": mouseMoved,
+    "mouseDragged": mouseDragged,
+    "mousePressed": mousePressed,
+    "mouseReleased": mouseReleased,
+    "mouseClicked": mouseClicked,
+    "doubleClicked": doubleClicked,
+    "mouseWheel": mouseWheel,
+    "touchStarted": touchStarted,
+    "touchMoved": touchMoved,
+    "touchEnded": touchEnded,
+    "windowResized": windowResized,
 }
 
-start_p5(source_sketch.setup, source_sketch.draw, event_functions)
\ No newline at end of file
+start_p5(setup, draw, event_functions)
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_010/index.html b/docs/examples/transcrypt/sketch_010/index.html
index 3f533b90..4064f358 100644
--- a/docs/examples/transcrypt/sketch_010/index.html
+++ b/docs/examples/transcrypt/sketch_010/index.html
@@ -47,9 +47,6 @@
         
              
-from pyp5js import *
-
-
 MY_POINTS = [
     (100, 50),
     (300, 100),
diff --git a/docs/examples/transcrypt/sketch_010/sketch_010.py b/docs/examples/transcrypt/sketch_010/sketch_010.py
index a55147fe..c7053f2b 100644
--- a/docs/examples/transcrypt/sketch_010/sketch_010.py
+++ b/docs/examples/transcrypt/sketch_010/sketch_010.py
@@ -1,6 +1,3 @@
-from pyp5js import *
-
-
 MY_POINTS = [
     (100, 50),
     (300, 100),
diff --git a/docs/examples/transcrypt/sketch_010/target/org.transcrypt.__runtime__.js b/docs/examples/transcrypt/sketch_010/target/org.transcrypt.__runtime__.js
index 842ed33c..d7f8923c 100644
--- a/docs/examples/transcrypt/sketch_010/target/org.transcrypt.__runtime__.js
+++ b/docs/examples/transcrypt/sketch_010/target/org.transcrypt.__runtime__.js
@@ -1,10 +1,10 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:41
+// Transcrypt'ed from Python, 2021-10-14 12:26:28
 var __name__ = 'org.transcrypt.__runtime__';
 export var __envir__ = {};
 __envir__.interpreter_name = 'python';
 __envir__.transpiler_name = 'transcrypt';
 __envir__.executor_name = __envir__.transpiler_name;
-__envir__.transpiler_version = '3.7.16';
+__envir__.transpiler_version = '3.9.0';
 
 export function __nest__ (headObject, tailNames, value) {
     var current = headObject;
@@ -38,15 +38,14 @@ export function __init__ (module) {
     }
     return module.__all__;
 };
-export var __proxy__ = false;
-export function __get__ (self, func, quotedFuncName) {
-    if (self) {
-        if (self.hasOwnProperty ('__class__') || typeof self == 'string' || self instanceof String) {
+export function __get__ (aThis, func, quotedFuncName) {
+    if (aThis) {
+        if (aThis.hasOwnProperty ('__class__') || typeof aThis == 'string' || aThis instanceof String) {
             if (quotedFuncName) {
-                Object.defineProperty (self, quotedFuncName, {
+                Object.defineProperty (aThis, quotedFuncName, {
                     value: function () {
                         var args = [] .slice.apply (arguments);
-                        return func.apply (null, [self] .concat (args));
+                        return func.apply (null, [aThis] .concat (args));
                     },
                     writable: true,
                     enumerable: true,
@@ -55,7 +54,7 @@ export function __get__ (self, func, quotedFuncName) {
             }
             return function () {
                 var args = [] .slice.apply (arguments);
-                return func.apply (null, [self] .concat (args));
+                return func.apply (null, [aThis.__proxy__ ? aThis.__proxy__ : aThis] .concat (args));
             };
         }
         else {
@@ -66,21 +65,21 @@ export function __get__ (self, func, quotedFuncName) {
         return func;
     }
 };
-export function __getcm__ (self, func, quotedFuncName) {
-    if (self.hasOwnProperty ('__class__')) {
+export function __getcm__ (aThis, func, quotedFuncName) {
+    if (aThis.hasOwnProperty ('__class__')) {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self.__class__] .concat (args));
+            return func.apply (null, [aThis.__class__] .concat (args));
         };
     }
     else {
         return function () {
             var args = [] .slice.apply (arguments);
-            return func.apply (null, [self] .concat (args));
+            return func.apply (null, [aThis] .concat (args));
         };
     }
 };
-export function __getsm__ (self, func, quotedFuncName) {
+export function __getsm__ (aThis, func, quotedFuncName) {
     return func;
 };
 export var py_metatype = {
@@ -95,6 +94,9 @@ export var py_metatype = {
             var base = bases [index];
             for (var attrib in base) {
                 var descrip = Object.getOwnPropertyDescriptor (base, attrib);
+                if (descrip == null) {
+                    continue;
+                }
                 Object.defineProperty (cls, attrib, descrip);
             }
             for (let symbol of Object.getOwnPropertySymbols (base)) {
@@ -125,7 +127,7 @@ export var object = {
     __new__: function (args) {
         var instance = Object.create (this, {__class__: {value: this, enumerable: true}});
         if ('__getattr__' in this || '__setattr__' in this) {
-            instance = new Proxy (instance, {
+            instance.__proxy__ = new Proxy (instance, {
                 get: function (target, name) {
                     let result = target [name];
                     if (result == undefined) {
@@ -145,6 +147,7 @@ export var object = {
                     return true;
                 }
             })
+			instance = instance.__proxy__
         }
         this.__init__.apply (null, [instance] .concat (args));
         return instance;
@@ -1830,10 +1833,13 @@ export var Exception =  __class__ ('Exception', [BaseException], {
 			var args = tuple ();
 		}
 		self.__args__ = args;
-		try {
+		if (kwargs.error != null) {
 			self.stack = kwargs.error.stack;
 		}
-		catch (__except0__) {
+		else if (Error) {
+			self.stack = new Error ().stack;
+		}
+		else {
 			self.stack = 'No stack trace available';
 		}
 	});},
diff --git a/docs/examples/transcrypt/sketch_010/target/org.transcrypt.__runtime__.py b/docs/examples/transcrypt/sketch_010/target/org.transcrypt.__runtime__.py
index 87834491..8b06f7ba 100644
--- a/docs/examples/transcrypt/sketch_010/target/org.transcrypt.__runtime__.py
+++ b/docs/examples/transcrypt/sketch_010/target/org.transcrypt.__runtime__.py
@@ -19,9 +19,11 @@ class Exception (BaseException):
     #__pragma__ ('kwargs')
     def __init__ (self, *args, **kwargs):
         self.__args__ = args
-        try:
+        if kwargs.error != None:
             self.stack = kwargs.error.stack # Integrate with JavaScript Error object
-        except:
+        elif Error:
+            self.stack = (__new__(Error())).stack # Create our own stack if we aren't given one
+        else:
             self.stack = 'No stack trace available'
     #__pragma__ ('nokwargs')
         
diff --git a/docs/examples/transcrypt/sketch_010/target/pyp5js.js b/docs/examples/transcrypt/sketch_010/target/pyp5js.js
index c0920fec..4b8cadc1 100644
--- a/docs/examples/transcrypt/sketch_010/target/pyp5js.js
+++ b/docs/examples/transcrypt/sketch_010/target/pyp5js.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:41
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:28
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
 import {PythonFunctions} from './python_functions.js';
 var __name__ = 'pyp5js';
 export var _P5_INSTANCE = null;
diff --git a/docs/examples/transcrypt/sketch_010/target/python_functions.js b/docs/examples/transcrypt/sketch_010/target/python_functions.js
index 61d9a110..96e8f286 100644
--- a/docs/examples/transcrypt/sketch_010/target/python_functions.js
+++ b/docs/examples/transcrypt/sketch_010/target/python_functions.js
@@ -1,5 +1,5 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:41
-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';
+// Transcrypt'ed from Python, 2021-10-14 12:26:29
+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';
 var __name__ = 'python_functions';
 export var PythonFunctions =  __class__ ('PythonFunctions', [object], {
 	__module__: __name__,
diff --git a/docs/examples/transcrypt/sketch_010/target/sketch_010.js b/docs/examples/transcrypt/sketch_010/target/sketch_010.js
deleted file mode 100644
index 2a5591f0..00000000
--- a/docs/examples/transcrypt/sketch_010/target/sketch_010.js
+++ /dev/null
@@ -1,242 +0,0 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:41
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-var __name__ = 'sketch_010';
-export var MY_POINTS = [tuple ([100, 50]), tuple ([300, 100]), tuple ([200, 300]), tuple ([100, 300])];
-export var FRAME_IDX = 0;
-export var POINT_SIZE = 10;
-export var CNV = null;
-export var setup = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	CNV = createCanvas (400, 400);
-	var BUTTON_PREV = createButton ('Previous frame');
-	BUTTON_PREV.position (CNV.position ().x, CNV.height + CNV.position ().y);
-	BUTTON_PREV.mousePressed (prev_frame);
-	var BUTTON_NEXT = createButton ('Next frame');
-	BUTTON_NEXT.position (CNV.position ().x + BUTTON_PREV.size ().width, BUTTON_PREV.position ().y);
-	BUTTON_NEXT.mousePressed (next_frame);
-	background (190);
-	draw_labels (MY_POINTS);
-};
-export var draw = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	background (190);
-	draw_closed_curve_vertex (MY_POINTS, FRAME_IDX);
-	draw_labels (MY_POINTS);
-};
-export var mouseClicked = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	if (is_point_in_canvas (mouseX, mouseY)) {
-		var i = get_point_index (mouseX, mouseY);
-		if (i != null) {
-			MY_POINTS.py_pop (i);
-			if (FRAME_IDX >= len (MY_POINTS)) {
-				FRAME_IDX = len (MY_POINTS) - 1;
-			}
-		}
-		else {
-			MY_POINTS.append (tuple ([mouseX, mouseY]));
-		}
-	}
-};
-export var get_point_index = function (x, y) {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-				switch (__attrib0__) {
-					case 'x': var x = __allkwargs0__ [__attrib0__]; break;
-					case 'y': var y = __allkwargs0__ [__attrib0__]; break;
-				}
-			}
-		}
-	}
-	else {
-	}
-	for (var [idx, [p_x, p_y]] of enumerate (MY_POINTS)) {
-		if ((p_x - POINT_SIZE < x && x < p_x + POINT_SIZE) && (p_y - POINT_SIZE < y && y < p_y + POINT_SIZE)) {
-			return idx;
-		}
-	}
-};
-export var is_point_in_canvas = function (x, y) {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-				switch (__attrib0__) {
-					case 'x': var x = __allkwargs0__ [__attrib0__]; break;
-					case 'y': var y = __allkwargs0__ [__attrib0__]; break;
-				}
-			}
-		}
-	}
-	else {
-	}
-	if ((x < 0 || x > CNV.width) || (y < 0 || y > CNV.height)) {
-		return false;
-	}
-	return true;
-};
-export var next_frame = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	if (FRAME_IDX < len (MY_POINTS) - 1) {
-		FRAME_IDX += 1;
-	}
-};
-export var prev_frame = function () {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-			}
-		}
-	}
-	else {
-	}
-	if (FRAME_IDX > 0) {
-		FRAME_IDX -= 1;
-	}
-};
-export var draw_closed_curve_vertex = function (points, max_idx) {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-				switch (__attrib0__) {
-					case 'points': var points = __allkwargs0__ [__attrib0__]; break;
-					case 'max_idx': var max_idx = __allkwargs0__ [__attrib0__]; break;
-				}
-			}
-		}
-	}
-	else {
-	}
-	if (len (points) < 2) {
-		return ;
-	}
-	var used_points = [];
-	beginShape ();
-	var idx = len (points) - 1;
-	curveVertex (...points [idx]);
-	used_points.append (idx);
-	for (var [idx, p] of enumerate (points)) {
-		if (idx > max_idx) {
-			break;
-		}
-		curveVertex (...p);
-		used_points.append (idx);
-	}
-	var idx = 0;
-	curveVertex (...points [idx]);
-	used_points.append (idx);
-	var idx = 1;
-	curveVertex (...points [idx]);
-	used_points.append (idx);
-	endShape ();
-	textSize (10);
-	noStroke ();
-	text ('Points used to draw this curve (first and last are control points only)', 5, CNV.height - 30);
-	textSize (20);
-	text (', '.join (used_points), 10, CNV.height - 10);
-	stroke (0);
-	for (var i = 0; i < len (used_points) - 1; i++) {
-		draw_dotted_line (points [used_points [i]], points [used_points [i + 1]]);
-	}
-};
-export var draw_labels = function (points) {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-				switch (__attrib0__) {
-					case 'points': var points = __allkwargs0__ [__attrib0__]; break;
-				}
-			}
-		}
-	}
-	else {
-	}
-	strokeWeight (POINT_SIZE);
-	for (var [idx, p] of enumerate (points)) {
-		var ts = 32;
-		textSize (ts);
-		var textY = p [1] - ts / 2;
-		if (p [1] > CNV.height / 2) {
-			var textY = p [1] + ts;
-		}
-		noStroke ();
-		text (idx, p [0], textY);
-		stroke (0);
-		point (...p);
-	}
-	strokeWeight (1);
-};
-export var draw_dotted_line = function (p1, p2) {
-	if (arguments.length) {
-		var __ilastarg0__ = arguments.length - 1;
-		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
-			var __allkwargs0__ = arguments [__ilastarg0__--];
-			for (var __attrib0__ in __allkwargs0__) {
-				switch (__attrib0__) {
-					case 'p1': var p1 = __allkwargs0__ [__attrib0__]; break;
-					case 'p2': var p2 = __allkwargs0__ [__attrib0__]; break;
-				}
-			}
-		}
-	}
-	else {
-	}
-	stroke (100);
-	strokeWeight (3);
-	for (var i = 0; i < 11; i++) {
-		var x = lerp (p1 [0], p2 [0], i / 10);
-		var y = lerp (p1 [1], p2 [1], i / 10);
-		point (x, y);
-	}
-	stroke (0);
-	strokeWeight (1);
-};
-
-//# sourceMappingURL=sketch_010.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_010/target/sketch_010.py b/docs/examples/transcrypt/sketch_010/target/sketch_010.py
deleted file mode 100644
index a55147fe..00000000
--- a/docs/examples/transcrypt/sketch_010/target/sketch_010.py
+++ /dev/null
@@ -1,139 +0,0 @@
-from pyp5js import *
-
-
-MY_POINTS = [
-    (100, 50),
-    (300, 100),
-    (200, 300),
-    (100, 300),
-]
-FRAME_IDX = 0
-POINT_SIZE = 10
-CNV = None
-
-def setup():
-    global CNV
-    CNV = createCanvas(400, 400)
-
-    BUTTON_PREV = createButton('Previous frame')
-    BUTTON_PREV.position(CNV.position().x,
-                         CNV.height + CNV.position().y)
-    BUTTON_PREV.mousePressed(prev_frame)
-
-    BUTTON_NEXT = createButton('Next frame')
-    BUTTON_NEXT.position(CNV.position().x + BUTTON_PREV.size().width,
-                         BUTTON_PREV.position().y)
-    BUTTON_NEXT.mousePressed(next_frame)
-
-    background(190)
-    draw_labels(MY_POINTS)
-
-def draw():
-    background(190)
-    draw_closed_curve_vertex(MY_POINTS, FRAME_IDX)
-    draw_labels(MY_POINTS)
-
-def mouseClicked():
-    global FRAME_IDX
-    global MY_POINTS
-    if is_point_in_canvas(mouseX, mouseY):
-        i = get_point_index(mouseX, mouseY)
-        if i != None:
-            MY_POINTS.pop(i)
-            if FRAME_IDX >= len(MY_POINTS):
-                # cap i if it exceeds maximum length now.
-                FRAME_IDX = len(MY_POINTS) - 1
-        else:
-            MY_POINTS.append((mouseX, mouseY))
-
-def get_point_index(x, y):
-    for idx, (p_x,p_y) in enumerate(MY_POINTS):
-        if (p_x - POINT_SIZE < x and x < p_x + POINT_SIZE) and \
-           (p_y - POINT_SIZE < y and y < p_y + POINT_SIZE):
-            return idx
-
-def is_point_in_canvas(x, y):
-    if (x < 0 or x > CNV.width) or \
-       (y < 0 or y > CNV.height):
-        return False
-    return True
-
-def next_frame():
-    global FRAME_IDX
-    if FRAME_IDX < len(MY_POINTS) - 1:
-        FRAME_IDX += 1
-
-def prev_frame():
-    global FRAME_IDX
-    if FRAME_IDX > 0:
-        FRAME_IDX -= 1
-
-def draw_closed_curve_vertex(points, max_idx):
-    if len(points) < 2:
-        return
-    used_points = []
-    beginShape()
-
-    # start by using the last point as the initial control point
-    idx = len(points) - 1
-    curveVertex(*points[idx])
-    used_points.append(idx)
-
-    # add each point to the curve
-    for idx,p in enumerate(points):
-        if idx > max_idx:
-            break
-        curveVertex(*p)
-        used_points.append(idx)
-
-    # to close the curve, we need to create the last curve.
-    # for that, we must go to the first point
-    idx = 0
-    curveVertex(*points[idx])
-    used_points.append(idx)
-
-    # and use the next point as a control point.
-    idx = 1
-    curveVertex(*points[idx])
-    used_points.append(idx)
-    endShape()
-
-    textSize(10)
-    noStroke()
-    text('Points used to draw this curve (first and last are control points only)', 5, CNV.height - 30)
-
-    textSize(20)
-    text(', '.join(used_points), 10, CNV.height - 10)
-    stroke(0)
-
-    for i in range(len(used_points) - 1):
-        draw_dotted_line(points[used_points[i]],
-                         points[used_points[i + 1]])
-
-def draw_labels(points):
-    strokeWeight(POINT_SIZE)
-    for idx, p in enumerate(points):
-        ts = 32
-        textSize(ts)
-        textY = p[1] - ts / 2
-
-        if p[1] > CNV.height / 2:
-            textY = p[1] + ts
-
-        noStroke()
-        text(idx, p[0], textY)
-        stroke(0)
-        point(*p)
-
-    strokeWeight(1)
-
-def draw_dotted_line(p1, p2):
-    stroke(100)
-    strokeWeight(3)
-    for i in range(11):
-        x = lerp(p1[0], p2[0], i/10)
-        y = lerp(p1[1], p2[1], i/10)
-        point(x, y)
-
-    stroke(0)
-    strokeWeight(1)
diff --git a/docs/examples/transcrypt/sketch_010/target/target_sketch.js b/docs/examples/transcrypt/sketch_010/target/target_sketch.js
index 5408f504..e5397c09 100644
--- a/docs/examples/transcrypt/sketch_010/target/target_sketch.js
+++ b/docs/examples/transcrypt/sketch_010/target/target_sketch.js
@@ -1,9 +1,287 @@
-// Transcrypt'ed from Python, 2021-09-20 17:40:41
-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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
-import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, draw, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, setup, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
-import * as source_sketch from './sketch_010.js';
+// Transcrypt'ed from Python, 2021-10-14 12:26:28
+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__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, isinstance, issubclass, len, list, object, ord, print, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, set, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
+import {ADD, ALT, ARROW, AUDIO, AUTO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC, BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST, DEGREES, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION, FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE, LEFT, LEFT_ARROW, LIGHTEST, LINEAR, LINES, LINE_LOOP, LINE_STRIP, MIRROR, MITER, MOVE, MULTIPLY, NEAREST, NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, PVector, QUADRATIC, QUADS, QUAD_STRIP, QUARTER_PI, RADIANS, RADIUS, RAD_TO_DEG, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW, ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL, _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, add_library, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, changed, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createA, createAudio, createButton, createCamera, createCanvas, createCapture, createCheckbox, createColorPicker, createDiv, createElement, createFileInput, createGraphics, createImage, createImg, createInput, createNumberDict, createP, createRadio, createSelect, createShader, createSlider, createSpan, createStringDict, createVector, createVideo, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceOrientation, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, ellipse, ellipseMode, ellipsoid, endContour, endShape, erase, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, image_proxy, input, int, join, key, keyCode, keyIsDown, keyIsPressed, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, logOnloaded, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseIsPressed, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noErase, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, popMatrix, popStyle, pow, pre_draw, preload, push, pushMatrix, pushStyle, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_set, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, removeElements, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, select, selectAll, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, size, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowWidth, year} from './pyp5js.js';
 var __name__ = '__main__';
-export var event_functions = dict ([['deviceMoved', source_sketch.deviceMoved], ['deviceTurned', source_sketch.deviceTurned], ['deviceShaken', source_sketch.deviceShaken], ['keyPressed', source_sketch.keyPressed], ['keyReleased', source_sketch.keyReleased], ['keyTyped', source_sketch.keyTyped], ['mouseMoved', source_sketch.mouseMoved], ['mouseDragged', source_sketch.mouseDragged], ['mousePressed', source_sketch.mousePressed], ['mouseReleased', source_sketch.mouseReleased], ['mouseClicked', source_sketch.mouseClicked], ['doubleClicked', source_sketch.doubleClicked], ['mouseWheel', source_sketch.mouseWheel], ['touchStarted', source_sketch.touchStarted], ['touchMoved', source_sketch.touchMoved], ['touchEnded', source_sketch.touchEnded], ['windowResized', source_sketch.windowResized]]);
-start_p5 (source_sketch.setup, source_sketch.draw, event_functions);
+export var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	// pass;
+};
+export var deviceMoved = null;
+export var deviceTurned = null;
+export var deviceShaken = null;
+export var keyPressed = null;
+export var keyReleased = null;
+export var keyTyped = null;
+export var mouseMoved = null;
+export var mouseDragged = null;
+export var mousePressed = null;
+export var mouseReleased = null;
+export var mouseClicked = null;
+export var doubleClicked = null;
+export var mouseWheel = null;
+export var touchStarted = null;
+export var touchMoved = null;
+export var touchEnded = null;
+export var windowResized = null;
+export var MY_POINTS = [tuple ([100, 50]), tuple ([300, 100]), tuple ([200, 300]), tuple ([100, 300])];
+export var FRAME_IDX = 0;
+export var POINT_SIZE = 10;
+export var CNV = null;
+var setup = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	CNV = createCanvas (400, 400);
+	var BUTTON_PREV = createButton ('Previous frame');
+	BUTTON_PREV.position (CNV.position ().x, CNV.height + CNV.position ().y);
+	BUTTON_PREV.mousePressed (prev_frame);
+	var BUTTON_NEXT = createButton ('Next frame');
+	BUTTON_NEXT.position (CNV.position ().x + BUTTON_PREV.size ().width, BUTTON_PREV.position ().y);
+	BUTTON_NEXT.mousePressed (next_frame);
+	background (190);
+	draw_labels (MY_POINTS);
+};
+var draw = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	background (190);
+	draw_closed_curve_vertex (MY_POINTS, FRAME_IDX);
+	draw_labels (MY_POINTS);
+};
+var mouseClicked = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	if (is_point_in_canvas (mouseX, mouseY)) {
+		var i = get_point_index (mouseX, mouseY);
+		if (i != null) {
+			MY_POINTS.py_pop (i);
+			if (FRAME_IDX >= len (MY_POINTS)) {
+				FRAME_IDX = len (MY_POINTS) - 1;
+			}
+		}
+		else {
+			MY_POINTS.append (tuple ([mouseX, mouseY]));
+		}
+	}
+};
+export var get_point_index = function (x, y) {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+				switch (__attrib0__) {
+					case 'x': var x = __allkwargs0__ [__attrib0__]; break;
+					case 'y': var y = __allkwargs0__ [__attrib0__]; break;
+				}
+			}
+		}
+	}
+	else {
+	}
+	for (var [idx, [p_x, p_y]] of enumerate (MY_POINTS)) {
+		if ((p_x - POINT_SIZE < x && x < p_x + POINT_SIZE) && (p_y - POINT_SIZE < y && y < p_y + POINT_SIZE)) {
+			return idx;
+		}
+	}
+};
+export var is_point_in_canvas = function (x, y) {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+				switch (__attrib0__) {
+					case 'x': var x = __allkwargs0__ [__attrib0__]; break;
+					case 'y': var y = __allkwargs0__ [__attrib0__]; break;
+				}
+			}
+		}
+	}
+	else {
+	}
+	if ((x < 0 || x > CNV.width) || (y < 0 || y > CNV.height)) {
+		return false;
+	}
+	return true;
+};
+export var next_frame = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	if (FRAME_IDX < len (MY_POINTS) - 1) {
+		FRAME_IDX++;
+	}
+};
+export var prev_frame = function () {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+			}
+		}
+	}
+	else {
+	}
+	if (FRAME_IDX > 0) {
+		FRAME_IDX--;
+	}
+};
+export var draw_closed_curve_vertex = function (points, max_idx) {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+				switch (__attrib0__) {
+					case 'points': var points = __allkwargs0__ [__attrib0__]; break;
+					case 'max_idx': var max_idx = __allkwargs0__ [__attrib0__]; break;
+				}
+			}
+		}
+	}
+	else {
+	}
+	if (len (points) < 2) {
+		return ;
+	}
+	var used_points = [];
+	beginShape ();
+	var idx = len (points) - 1;
+	curveVertex (...points [idx]);
+	used_points.append (idx);
+	for (var [idx, p] of enumerate (points)) {
+		if (idx > max_idx) {
+			break;
+		}
+		curveVertex (...p);
+		used_points.append (idx);
+	}
+	var idx = 0;
+	curveVertex (...points [idx]);
+	used_points.append (idx);
+	var idx = 1;
+	curveVertex (...points [idx]);
+	used_points.append (idx);
+	endShape ();
+	textSize (10);
+	noStroke ();
+	text ('Points used to draw this curve (first and last are control points only)', 5, CNV.height - 30);
+	textSize (20);
+	text (', '.join (used_points), 10, CNV.height - 10);
+	stroke (0);
+	for (var i = 0; i < len (used_points) - 1; i++) {
+		draw_dotted_line (points [used_points [i]], points [used_points [i + 1]]);
+	}
+};
+export var draw_labels = function (points) {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+				switch (__attrib0__) {
+					case 'points': var points = __allkwargs0__ [__attrib0__]; break;
+				}
+			}
+		}
+	}
+	else {
+	}
+	strokeWeight (POINT_SIZE);
+	for (var [idx, p] of enumerate (points)) {
+		var ts = 32;
+		textSize (ts);
+		var textY = p [1] - ts / 2;
+		if (p [1] > CNV.height / 2) {
+			var textY = p [1] + ts;
+		}
+		noStroke ();
+		text (idx, p [0], textY);
+		stroke (0);
+		point (...p);
+	}
+	strokeWeight (1);
+};
+export var draw_dotted_line = function (p1, p2) {
+	if (arguments.length) {
+		var __ilastarg0__ = arguments.length - 1;
+		if (arguments [__ilastarg0__] && arguments [__ilastarg0__].hasOwnProperty ("__kwargtrans__")) {
+			var __allkwargs0__ = arguments [__ilastarg0__--];
+			for (var __attrib0__ in __allkwargs0__) {
+				switch (__attrib0__) {
+					case 'p1': var p1 = __allkwargs0__ [__attrib0__]; break;
+					case 'p2': var p2 = __allkwargs0__ [__attrib0__]; break;
+				}
+			}
+		}
+	}
+	else {
+	}
+	stroke (100);
+	strokeWeight (3);
+	for (var i = 0; i < 11; i++) {
+		var x = lerp (p1 [0], p2 [0], i / 10);
+		var y = lerp (p1 [1], p2 [1], i / 10);
+		point (x, y);
+	}
+	stroke (0);
+	strokeWeight (1);
+};
+export var event_functions = dict ({'deviceMoved': deviceMoved, 'deviceTurned': deviceTurned, 'deviceShaken': deviceShaken, 'keyPressed': keyPressed, 'keyReleased': keyReleased, 'keyTyped': keyTyped, 'mouseMoved': mouseMoved, 'mouseDragged': mouseDragged, 'mousePressed': mousePressed, 'mouseReleased': mouseReleased, 'mouseClicked': mouseClicked, 'doubleClicked': doubleClicked, 'mouseWheel': mouseWheel, 'touchStarted': touchStarted, 'touchMoved': touchMoved, 'touchEnded': touchEnded, 'windowResized': windowResized});
+start_p5 (setup, draw, event_functions);
 
 //# sourceMappingURL=target_sketch.map
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_010/target/target_sketch.project b/docs/examples/transcrypt/sketch_010/target/target_sketch.project
index b6452495..510bb36c 100644
--- a/docs/examples/transcrypt/sketch_010/target/target_sketch.project
+++ b/docs/examples/transcrypt/sketch_010/target/target_sketch.project
@@ -1 +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, "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"}, {"source": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_010/sketch_010.py", "target": "/home/bernardo/envs/pyp5js/docs/examples/transcrypt/sketch_010/__target__/sketch_010.js"}]}
\ No newline at end of file
+{"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.9/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"}]}
\ No newline at end of file
diff --git a/docs/examples/transcrypt/sketch_010/target/target_sketch.py b/docs/examples/transcrypt/sketch_010/target/target_sketch.py
index a0ab3ac4..1dd65bc3 100644
--- a/docs/examples/transcrypt/sketch_010/target/target_sketch.py
+++ b/docs/examples/transcrypt/sketch_010/target/target_sketch.py
@@ -1,24 +1,187 @@
-import sketch_010 as source_sketch
 from pyp5js import *
 
+def setup():
+    pass
+
+def draw():
+    pass
+
+deviceMoved = None
+deviceTurned = None
+deviceShaken = None
+keyPressed = None
+keyReleased = None
+keyTyped = None
+mouseMoved = None
+mouseDragged = None
+mousePressed = None
+mouseReleased = None
+mouseClicked = None
+doubleClicked = None
+mouseWheel = None
+touchStarted = None
+touchMoved = None
+touchEnded = None
+windowResized = None
+
+
+MY_POINTS = [
+    (100, 50),
+    (300, 100),
+    (200, 300),
+    (100, 300),
+]
+FRAME_IDX = 0
+POINT_SIZE = 10
+CNV = None
+
+def setup():
+    global CNV
+    CNV = createCanvas(400, 400)
+
+    BUTTON_PREV = createButton('Previous frame')
+    BUTTON_PREV.position(CNV.position().x,
+                         CNV.height + CNV.position().y)
+    BUTTON_PREV.mousePressed(prev_frame)
+
+    BUTTON_NEXT = createButton('Next frame')
+    BUTTON_NEXT.position(CNV.position().x + BUTTON_PREV.size().width,
+                         BUTTON_PREV.position().y)
+    BUTTON_NEXT.mousePressed(next_frame)
+
+    background(190)
+    draw_labels(MY_POINTS)
+
+def draw():
+    background(190)
+    draw_closed_curve_vertex(MY_POINTS, FRAME_IDX)
+    draw_labels(MY_POINTS)
+
+def mouseClicked():
+    global FRAME_IDX
+    global MY_POINTS
+    if is_point_in_canvas(mouseX, mouseY):
+        i = get_point_index(mouseX, mouseY)
+        if i != None:
+            MY_POINTS.pop(i)
+            if FRAME_IDX >= len(MY_POINTS):
+                # cap i if it exceeds maximum length now.
+                FRAME_IDX = len(MY_POINTS) - 1
+        else:
+            MY_POINTS.append((mouseX, mouseY))
+
+def get_point_index(x, y):
+    for idx, (p_x,p_y) in enumerate(MY_POINTS):
+        if (p_x - POINT_SIZE < x and x < p_x + POINT_SIZE) and \
+           (p_y - POINT_SIZE < y and y < p_y + POINT_SIZE):
+            return idx
+
+def is_point_in_canvas(x, y):
+    if (x < 0 or x > CNV.width) or \
+       (y < 0 or y > CNV.height):
+        return False
+    return True
+
+def next_frame():
+    global FRAME_IDX
+    if FRAME_IDX < len(MY_POINTS) - 1:
+        FRAME_IDX += 1
+
+def prev_frame():
+    global FRAME_IDX
+    if FRAME_IDX > 0:
+        FRAME_IDX -= 1
+
+def draw_closed_curve_vertex(points, max_idx):
+    if len(points) < 2:
+        return
+    used_points = []
+    beginShape()
+
+    # start by using the last point as the initial control point
+    idx = len(points) - 1
+    curveVertex(*points[idx])
+    used_points.append(idx)
+
+    # add each point to the curve
+    for idx,p in enumerate(points):
+        if idx > max_idx:
+            break
+        curveVertex(*p)
+        used_points.append(idx)
+
+    # to close the curve, we need to create the last curve.
+    # for that, we must go to the first point
+    idx = 0
+    curveVertex(*points[idx])
+    used_points.append(idx)
+
+    # and use the next point as a control point.
+    idx = 1
+    curveVertex(*points[idx])
+    used_points.append(idx)
+    endShape()
+
+    textSize(10)
+    noStroke()
+    text('Points used to draw this curve (first and last are control points only)', 5, CNV.height - 30)
+
+    textSize(20)
+    text(', '.join(used_points), 10, CNV.height - 10)
+    stroke(0)
+
+    for i in range(len(used_points) - 1):
+        draw_dotted_line(points[used_points[i]],
+                         points[used_points[i + 1]])
+
+def draw_labels(points):
+    strokeWeight(POINT_SIZE)
+    for idx, p in enumerate(points):
+        ts = 32
+        textSize(ts)
+        textY = p[1] - ts / 2
+
+        if p[1] > CNV.height / 2:
+            textY = p[1] + ts
+
+        noStroke()
+        text(idx, p[0], textY)
+        stroke(0)
+        point(*p)
+
+    strokeWeight(1)
+
+def draw_dotted_line(p1, p2):
+    stroke(100)
+    strokeWeight(3)
+    for i in range(11):
+        x = lerp(p1[0], p2[0], i/10)
+        y = lerp(p1[1], p2[1], i/10)
+        point(x, y)
+
+    stroke(0)
+    strokeWeight(1)
+
+
+
 event_functions = {
-    "deviceMoved": source_sketch.deviceMoved,
-    "deviceTurned": source_sketch.deviceTurned,
-    "deviceShaken": source_sketch.deviceShaken,
-    "keyPressed": source_sketch.keyPressed,
-    "keyReleased": source_sketch.keyReleased,
-    "keyTyped": source_sketch.keyTyped,
-    "mouseMoved": source_sketch.mouseMoved,
-    "mouseDragged": source_sketch.mouseDragged,
-    "mousePressed": source_sketch.mousePressed,
-    "mouseReleased": source_sketch.mouseReleased,
-    "mouseClicked": source_sketch.mouseClicked,
-    "doubleClicked": source_sketch.doubleClicked,
-    "mouseWheel": source_sketch.mouseWheel,
-    "touchStarted": source_sketch.touchStarted,
-    "touchMoved": source_sketch.touchMoved,
-    "touchEnded": source_sketch.touchEnded,
-    "windowResized": source_sketch.windowResized,
+    "deviceMoved": deviceMoved,
+    "deviceTurned": deviceTurned,
+    "deviceShaken": deviceShaken,
+    "keyPressed": keyPressed,
+    "keyReleased": keyReleased,
+    "keyTyped": keyTyped,
+    "mouseMoved": mouseMoved,
+    "mouseDragged": mouseDragged,
+    "mousePressed": mousePressed,
+    "mouseReleased": mouseReleased,
+    "mouseClicked": mouseClicked,
+    "doubleClicked": doubleClicked,
+    "mouseWheel": mouseWheel,
+    "touchStarted": touchStarted,
+    "touchMoved": touchMoved,
+    "touchEnded": touchEnded,
+    "windowResized": windowResized,
 }
 
-start_p5(source_sketch.setup, source_sketch.draw, event_functions)
\ No newline at end of file
+start_p5(setup, draw, event_functions)
\ No newline at end of file
diff --git a/docs/index.md b/docs/index.md
index ef4161d9..efb8815a 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -151,39 +151,7 @@ $ pyp5js --help
 
 ## How can I contribute?
 
-### Testing, testing and testing
-
-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.
-
-### What about these shinning examples?
-
-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.
-
-### I want to hack!
-
-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:
-
-```
-$ git clone git@github.com:YOUR_GITHUB_PROFILE/pyp5js.git
-$ cd pyp5js
-$ pip install -r dev-requirements.txt
-$ python setup.py develop
-$ make test
-```
-
-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:
-
-- `config` module: centralize pieces of code used to configure how `pyp5js` runs
-- `cli.py`: the entrypoint for `pyp5js` commands such as `new` or `compile`
-- `commands.py`: just functions responsible for the real implementations for `pyp5js` commands
-- `compiler.py`: where all the magic happens!
-- `exception.py`: custom exceptions used by `pyp5js`
-- `monitor.py`: module with the objects used by the `monitor` command
-- `sketch.py`: class to abstract Sketches' files, directories and configuration
-- `template_renderers.py`: simple module with the renderization logic for the code templates like `target_sketch.py`
-- `http/web_app.py`: Flask application for the web interface.
-
-Now go [fetch yourself an issue](https://github.com/berinhard/pyp5js/issues) and happy hacking!
+More details [here](https://github.com/berinhard/pyp5js/blob/develop/CONTRIBUTING.md).
 
 ### References
 
diff --git a/docs/pyodide/index.html b/docs/pyodide/index.html
index e241d158..f132e3be 100644
--- a/docs/pyodide/index.html
+++ b/docs/pyodide/index.html
@@ -20,6 +20,7 @@
     
     
     
+    
 
     
 
@@ -47,7 +48,7 @@
   
 
   
-

pyp5js editor

+

pyp5js demo editor

@@ -55,7 +56,7 @@
- +
@@ -68,1526 +69,7 @@

pyp5js running on top of pyodide

- + \ No newline at end of file diff --git a/docs/pyodide/index.html.template b/docs/pyodide/index.html.template new file mode 100644 index 00000000..93bca4ea --- /dev/null +++ b/docs/pyodide/index.html.template @@ -0,0 +1,122 @@ + + + + + + + + + pyp5js with Pyodide Demo + + + + + + + + + + + + + + + + + + + + + +

pyp5js demo editor

+ +
+
+ + +
+
+ + +
+
+ +
+ +
+
+

If you execute the code but nothing is being rendered in the broswer, please open your browser's console to read the error traceback (usually you can do this by pressing F12 and clicking in the Console tab).

+

pyp5js running on top of pyodide

+ + + + + diff --git a/docs/pyodide/pyodide.py b/docs/pyodide/pyodide.py new file mode 100644 index 00000000..16df526e --- /dev/null +++ b/docs/pyodide/pyodide.py @@ -0,0 +1,8 @@ +def setup(): + createCanvas(200, 200) + +def draw(): + background(200) + diameter = sin(frameCount / 60) * 50 + 50 + fill("blue") + ellipse(100, 100, diameter, diameter) diff --git a/docs/pyodide/target/target_sketch.js b/docs/pyodide/target/target_sketch.js new file mode 100644 index 00000000..0a1ae15f --- /dev/null +++ b/docs/pyodide/target/target_sketch.js @@ -0,0 +1,1677 @@ +let wrapper_content = ` +class PythonFunctions: pass + +setattr(PythonFunctions, 'map', map) +setattr(PythonFunctions, 'filter', filter) +setattr(PythonFunctions, 'set', set) + + +_P5_INSTANCE = None + +_CTX_MIDDLE = None +_DEFAULT_FILL = None +_DEFAULT_LEADMULT = None +_DEFAULT_STROKE = None +_DEFAULT_TEXT_FILL = None + +ADD = None +ALT = None +ARROW = None +AUDIO = None +AUTO = None +AXES = None +BACKSPACE = None +BASELINE = None +BEVEL = None +BEZIER = None +BLEND = None +BLUR = None +BOLD = None +BOLDITALIC = None +BOTTOM = None +BURN = None +CENTER = None +CHORD = None +CLAMP = None +CLOSE = None +CONTROL = None +CORNER = None +CORNERS = None +CROSS = None +CURVE = None +DARKEST = None +DEG_TO_RAD = None +DEGREES = None +DELETE = None +DIFFERENCE = None +DILATE = None +DODGE = None +DOWN_ARROW = None +ENTER = None +ERODE = None +ESCAPE = None +EXCLUSION = None +FILL = None +GRAY = None +GRID = None +HALF_PI = None +HAND = None +HARD_LIGHT = None +HSB = None +HSL = None +IMAGE = None +IMMEDIATE = None +INVERT = None +ITALIC = None +LANDSCAPE = None +LEFT = None +LEFT_ARROW = None +LIGHTEST = None +LINE_LOOP = None +LINE_STRIP = None +LINEAR = None +LINES = None +MIRROR = None +MITER = None +MOVE = None +MULTIPLY = None +NEAREST = None +NORMAL = None +OPAQUE = None +OPEN = None +OPTION = None +OVERLAY = None +PI = None +PIE = None +POINTS = None +PORTRAIT = None +POSTERIZE = None +PROJECT = None +QUAD_STRIP = None +QUADRATIC = None +QUADS = None +QUARTER_PI = None +RAD_TO_DEG = None +RADIANS = None +RADIUS = None +REPEAT = None +REPLACE = None +RETURN = None +RGB = None +RIGHT = None +RIGHT_ARROW = None +ROUND = None +SCREEN = None +SHIFT = None +SOFT_LIGHT = None +SQUARE = None +STROKE = None +SUBTRACT = None +TAB = None +TAU = None +TEXT = None +TEXTURE = None +THRESHOLD = None +TOP = None +TRIANGLE_FAN = None +TRIANGLE_STRIP = None +TRIANGLES = None +TWO_PI = None +UP_ARROW = None +VIDEO = None +WAIT = None +WEBGL = None +P2D = None +PI = None + +frameCount = None +focused = None +displayWidth = None +displayHeight = None +windowWidth = None +windowHeight = None +width = None +height = None +deviceOrientation = None +accelerationX = None +accelerationY = None +accelerationZ = None +pAccelerationX = None +pAccelerationY = None +pAccelerationZ = None +rotationX = None +rotationY = None +rotationZ = None +pRotationX = None +pRotationY = None +pRotationZ = None +turnAxis = None +keyIsPressed = None +key = None +keyCode = None +mouseX = None +mouseY = None +pmouseX = None +pmouseY = None +winMouseX = None +winMouseY = None +pwinMouseX = None +pwinMouseY = None +mouseButton = None +mouseIsPressed = None +touches = None +pixels = None + + +def alpha(*args): + return _P5_INSTANCE.alpha(*args) + +def blue(*args): + return _P5_INSTANCE.blue(*args) + +def brightness(*args): + return _P5_INSTANCE.brightness(*args) + +def color(*args): + return _P5_INSTANCE.color(*args) + +def green(*args): + return _P5_INSTANCE.green(*args) + +def hue(*args): + return _P5_INSTANCE.hue(*args) + +def lerpColor(*args): + return _P5_INSTANCE.lerpColor(*args) + +def lightness(*args): + return _P5_INSTANCE.lightness(*args) + +def red(*args): + return _P5_INSTANCE.red(*args) + +def saturation(*args): + return _P5_INSTANCE.saturation(*args) + +def background(*args): + return _P5_INSTANCE.background(*args) + +def clear(*args): + p5_clear = _P5_INSTANCE.clear(*args) + return p5_clear + +def erase(*args): + return _P5_INSTANCE.erase(*args) + +def noErase(*args): + return _P5_INSTANCE.noErase(*args) + +def colorMode(*args): + return _P5_INSTANCE.colorMode(*args) + +def fill(*args): + return _P5_INSTANCE.fill(*args) + +def noFill(*args): + return _P5_INSTANCE.noFill(*args) + +def noStroke(*args): + return _P5_INSTANCE.noStroke(*args) + +def stroke(*args): + return _P5_INSTANCE.stroke(*args) + +def arc(*args): + return _P5_INSTANCE.arc(*args) + +def ellipse(*args): + return _P5_INSTANCE.ellipse(*args) + +def circle(*args): + return _P5_INSTANCE.circle(*args) + +def line(*args): + return _P5_INSTANCE.line(*args) + +def point(*args): + return _P5_INSTANCE.point(*args) + +def quad(*args): + return _P5_INSTANCE.quad(*args) + +def rect(*args): + return _P5_INSTANCE.rect(*args) + +def square(*args): + return _P5_INSTANCE.square(*args) + +def triangle(*args): + return _P5_INSTANCE.triangle(*args) + +def plane(*args): + return _P5_INSTANCE.plane(*args) + +def box(*args): + return _P5_INSTANCE.box(*args) + +def sphere(*args): + return _P5_INSTANCE.sphere(*args) + +def cylinder(*args): + return _P5_INSTANCE.cylinder(*args) + +def cone(*args): + return _P5_INSTANCE.cone(*args) + +def ellipsoid(*args): + return _P5_INSTANCE.ellipsoid(*args) + +def torus(*args): + return _P5_INSTANCE.torus(*args) + +def loadModel(*args): + return _P5_INSTANCE.loadModel(*args) + +def model(*args): + return _P5_INSTANCE.model(*args) + +def ellipseMode(*args): + return _P5_INSTANCE.ellipseMode(*args) + +def noSmooth(*args): + return _P5_INSTANCE.noSmooth(*args) + +def rectMode(*args): + return _P5_INSTANCE.rectMode(*args) + +def smooth(*args): + return _P5_INSTANCE.smooth(*args) + +def strokeCap(*args): + return _P5_INSTANCE.strokeCap(*args) + +def strokeJoin(*args): + return _P5_INSTANCE.strokeJoin(*args) + +def strokeWeight(*args): + return _P5_INSTANCE.strokeWeight(*args) + +def bezier(*args): + return _P5_INSTANCE.bezier(*args) + +def bezierDetail(*args): + return _P5_INSTANCE.bezierDetail(*args) + +def bezierPoint(*args): + return _P5_INSTANCE.bezierPoint(*args) + +def bezierTangent(*args): + return _P5_INSTANCE.bezierTangent(*args) + +def curve(*args): + return _P5_INSTANCE.curve(*args) + +def curveDetail(*args): + return _P5_INSTANCE.curveDetail(*args) + +def curveTightness(*args): + return _P5_INSTANCE.curveTightness(*args) + +def curvePoint(*args): + return _P5_INSTANCE.curvePoint(*args) + +def curveTangent(*args): + return _P5_INSTANCE.curveTangent(*args) + +def beginContour(*args): + return _P5_INSTANCE.beginContour(*args) + +def beginShape(*args): + return _P5_INSTANCE.beginShape(*args) + +def bezierVertex(*args): + return _P5_INSTANCE.bezierVertex(*args) + +def curveVertex(*args): + return _P5_INSTANCE.curveVertex(*args) + +def endContour(*args): + return _P5_INSTANCE.endContour(*args) + +def endShape(*args): + return _P5_INSTANCE.endShape(*args) + +def quadraticVertex(*args): + return _P5_INSTANCE.quadraticVertex(*args) + +def vertex(*args): + return _P5_INSTANCE.vertex(*args) + +def cursor(*args): + return _P5_INSTANCE.cursor(*args) + +def frameRate(*args): + return _P5_INSTANCE.frameRate(*args) + +def noCursor(*args): + return _P5_INSTANCE.noCursor(*args) + +def fullscreen(*args): + return _P5_INSTANCE.fullscreen(*args) + +def pixelDensity(*args): + return _P5_INSTANCE.pixelDensity(*args) + +def displayDensity(*args): + return _P5_INSTANCE.displayDensity(*args) + +def getURL(*args): + return _P5_INSTANCE.getURL(*args) + +def getURLPath(*args): + return _P5_INSTANCE.getURLPath(*args) + +def getURLParams(*args): + return _P5_INSTANCE.getURLParams(*args) + +def preload(*args): + return _P5_INSTANCE.preload(*args) + +def remove(*args): + return _P5_INSTANCE.remove(*args) + +def noLoop(*args): + return _P5_INSTANCE.noLoop(*args) + +def loop(*args): + return _P5_INSTANCE.loop(*args) + +def push(*args): + return _P5_INSTANCE.push(*args) + +def redraw(*args): + return _P5_INSTANCE.redraw(*args) + +def resizeCanvas(*args): + return _P5_INSTANCE.resizeCanvas(*args) + +def noCanvas(*args): + return _P5_INSTANCE.noCanvas(*args) + +def createGraphics(*args): + return _P5_INSTANCE.createGraphics(*args) + +def blendMode(*args): + return _P5_INSTANCE.blendMode(*args) + +def setAttributes(*args): + return _P5_INSTANCE.setAttributes(*args) + +def applyMatrix(*args): + return _P5_INSTANCE.applyMatrix(*args) + +def resetMatrix(*args): + return _P5_INSTANCE.resetMatrix(*args) + +def rotate(*args): + return _P5_INSTANCE.rotate(*args) + +def rotateX(*args): + return _P5_INSTANCE.rotateX(*args) + +def rotateY(*args): + return _P5_INSTANCE.rotateY(*args) + +def rotateZ(*args): + return _P5_INSTANCE.rotateZ(*args) + +def scale(*args): + return _P5_INSTANCE.scale(*args) + +def shearX(*args): + return _P5_INSTANCE.shearX(*args) + +def shearY(*args): + return _P5_INSTANCE.shearY(*args) + +def translate(*args): + return _P5_INSTANCE.translate(*args) + +def createStringDict(*args): + return _P5_INSTANCE.createStringDict(*args) + +def createNumberDict(*args): + return _P5_INSTANCE.createNumberDict(*args) + +def append(*args): + return _P5_INSTANCE.append(*args) + +def arrayCopy(*args): + return _P5_INSTANCE.arrayCopy(*args) + +def concat(*args): + return _P5_INSTANCE.concat(*args) + +def reverse(*args): + return _P5_INSTANCE.reverse(*args) + +def shorten(*args): + return _P5_INSTANCE.shorten(*args) + +def shuffle(*args): + return _P5_INSTANCE.shuffle(*args) + +def sort(*args): + return _P5_INSTANCE.sort(*args) + +def splice(*args): + return _P5_INSTANCE.splice(*args) + +def subset(*args): + return _P5_INSTANCE.subset(*args) + +def float(*args): + return _P5_INSTANCE.float(*args) + +def int(*args): + return _P5_INSTANCE.int(*args) + +def str(*args): + return _P5_INSTANCE.str(*args) + +def boolean(*args): + return _P5_INSTANCE.boolean(*args) + +def byte(*args): + return _P5_INSTANCE.byte(*args) + +def char(*args): + return _P5_INSTANCE.char(*args) + +def unchar(*args): + return _P5_INSTANCE.unchar(*args) + +def hex(*args): + return _P5_INSTANCE.hex(*args) + +def unhex(*args): + return _P5_INSTANCE.unhex(*args) + +def join(*args): + return _P5_INSTANCE.join(*args) + +def match(*args): + return _P5_INSTANCE.match(*args) + +def matchAll(*args): + return _P5_INSTANCE.matchAll(*args) + +def nf(*args): + return _P5_INSTANCE.nf(*args) + +def nfc(*args): + return _P5_INSTANCE.nfc(*args) + +def nfp(*args): + return _P5_INSTANCE.nfp(*args) + +def nfs(*args): + return _P5_INSTANCE.nfs(*args) + +def split(*args): + return _P5_INSTANCE.split(*args) + +def splitTokens(*args): + return _P5_INSTANCE.splitTokens(*args) + +def trim(*args): + return _P5_INSTANCE.trim(*args) + +def setMoveThreshold(*args): + return _P5_INSTANCE.setMoveThreshold(*args) + +def setShakeThreshold(*args): + return _P5_INSTANCE.setShakeThreshold(*args) + +def keyIsDown(*args): + return _P5_INSTANCE.keyIsDown(*args) + +def createImage(*args): + return _P5_INSTANCE.createImage(*args) + +def saveCanvas(*args): + return _P5_INSTANCE.saveCanvas(*args) + +def saveFrames(*args): + return _P5_INSTANCE.saveFrames(*args) + +def loadImage(*args): + return _P5_INSTANCE.loadImage(*args) + +def image(*args): + return _P5_INSTANCE.image(*args) + +def tint(*args): + return _P5_INSTANCE.tint(*args) + +def noTint(*args): + return _P5_INSTANCE.noTint(*args) + +def imageMode(*args): + return _P5_INSTANCE.imageMode(*args) + +def blend(*args): + return _P5_INSTANCE.blend(*args) + +def copy(*args): + return _P5_INSTANCE.copy(*args) + +def filter(*args): + if len(args) > 1 and (args[0] is None or callable(args[0])): + return PythonFunctions.filter(*args) + else: + return _P5_INSTANCE.filter(*args) + +def get(*args): + return _P5_INSTANCE.get(*args) + +def loadPixels(*args): + return _P5_INSTANCE.loadPixels(*args) + +def set(*args): + if len(args) <= 1: + return PythonFunctions.set(*args) + else: + return _P5_INSTANCE.set(*args) + +def updatePixels(*args): + return _P5_INSTANCE.updatePixels(*args) + +def loadJSON(*args): + return _P5_INSTANCE.loadJSON(*args) + +def loadStrings(*args): + return _P5_INSTANCE.loadStrings(*args) + +def loadTable(*args): + return _P5_INSTANCE.loadTable(*args) + +def loadXML(*args): + return _P5_INSTANCE.loadXML(*args) + +def loadBytes(*args): + return _P5_INSTANCE.loadBytes(*args) + +def httpGet(*args): + return _P5_INSTANCE.httpGet(*args) + +def httpPost(*args): + return _P5_INSTANCE.httpPost(*args) + +def httpDo(*args): + return _P5_INSTANCE.httpDo(*args) + +def createWriter(*args): + return _P5_INSTANCE.createWriter(*args) + +def save(*args): + return _P5_INSTANCE.save(*args) + +def saveJSON(*args): + return _P5_INSTANCE.saveJSON(*args) + +def saveStrings(*args): + return _P5_INSTANCE.saveStrings(*args) + +def saveTable(*args): + return _P5_INSTANCE.saveTable(*args) + +def day(*args): + return _P5_INSTANCE.day(*args) + +def hour(*args): + return _P5_INSTANCE.hour(*args) + +def minute(*args): + return _P5_INSTANCE.minute(*args) + +def millis(*args): + return _P5_INSTANCE.millis(*args) + +def month(*args): + return _P5_INSTANCE.month(*args) + +def second(*args): + return _P5_INSTANCE.second(*args) + +def year(*args): + return _P5_INSTANCE.year(*args) + +def createVector(*args): + return _P5_INSTANCE.createVector(*args) + +def abs(*args): + return _P5_INSTANCE.abs(*args) + +def ceil(*args): + return _P5_INSTANCE.ceil(*args) + +def constrain(*args): + return _P5_INSTANCE.constrain(*args) + +def dist(*args): + return _P5_INSTANCE.dist(*args) + +def exp(*args): + return _P5_INSTANCE.exp(*args) + +def floor(*args): + return _P5_INSTANCE.floor(*args) + +def lerp(*args): + return _P5_INSTANCE.lerp(*args) + +def log(*args): + return _P5_INSTANCE.log(*args) + +def mag(*args): + return _P5_INSTANCE.mag(*args) + +def map(*args): + if len(args) > 1 and callable(args[0]): + return PythonFunctions.map(*args) + else: + return _P5_INSTANCE.map(*args) + +def max(*args): + return _P5_INSTANCE.max(*args) + +def min(*args): + return _P5_INSTANCE.min(*args) + +def norm(*args): + return _P5_INSTANCE.norm(*args) + +def pow(*args): + return _P5_INSTANCE.pow(*args) + +def round(*args): + return _P5_INSTANCE.round(*args) + +def sq(*args): + return _P5_INSTANCE.sq(*args) + +def sqrt(*args): + return _P5_INSTANCE.sqrt(*args) + +def noise(*args): + return _P5_INSTANCE.noise(*args) + +def noiseDetail(*args): + return _P5_INSTANCE.noiseDetail(*args) + +def noiseSeed(*args): + return _P5_INSTANCE.noiseSeed(*args) + +def randomSeed(*args): + return _P5_INSTANCE.randomSeed(*args) + +def random(*args): + return _P5_INSTANCE.random(*args) + +def randomGaussian(*args): + return _P5_INSTANCE.randomGaussian(*args) + +def acos(*args): + return _P5_INSTANCE.acos(*args) + +def asin(*args): + return _P5_INSTANCE.asin(*args) + +def atan(*args): + return _P5_INSTANCE.atan(*args) + +def atan2(*args): + return _P5_INSTANCE.atan2(*args) + +def cos(*args): + return _P5_INSTANCE.cos(*args) + +def sin(*args): + return _P5_INSTANCE.sin(*args) + +def tan(*args): + return _P5_INSTANCE.tan(*args) + +def degrees(*args): + return _P5_INSTANCE.degrees(*args) + +def radians(*args): + return _P5_INSTANCE.radians(*args) + +def angleMode(*args): + return _P5_INSTANCE.angleMode(*args) + +def textAlign(*args): + return _P5_INSTANCE.textAlign(*args) + +def textLeading(*args): + return _P5_INSTANCE.textLeading(*args) + +def textSize(*args): + return _P5_INSTANCE.textSize(*args) + +def textStyle(*args): + return _P5_INSTANCE.textStyle(*args) + +def textWidth(*args): + return _P5_INSTANCE.textWidth(*args) + +def textAscent(*args): + return _P5_INSTANCE.textAscent(*args) + +def textDescent(*args): + return _P5_INSTANCE.textDescent(*args) + +def loadFont(*args): + return _P5_INSTANCE.loadFont(*args) + +def text(*args): + return _P5_INSTANCE.text(*args) + +def textFont(*args): + return _P5_INSTANCE.textFont(*args) + +def orbitControl(*args): + return _P5_INSTANCE.orbitControl(*args) + +def debugMode(*args): + return _P5_INSTANCE.debugMode(*args) + +def noDebugMode(*args): + return _P5_INSTANCE.noDebugMode(*args) + +def ambientLight(*args): + return _P5_INSTANCE.ambientLight(*args) + +def directionalLight(*args): + return _P5_INSTANCE.directionalLight(*args) + +def pointLight(*args): + return _P5_INSTANCE.pointLight(*args) + +def lights(*args): + return _P5_INSTANCE.lights(*args) + +def loadShader(*args): + return _P5_INSTANCE.loadShader(*args) + +def createShader(*args): + return _P5_INSTANCE.createShader(*args) + +def shader(*args): + return _P5_INSTANCE.shader(*args) + +def resetShader(*args): + return _P5_INSTANCE.resetShader(*args) + +def normalMaterial(*args): + return _P5_INSTANCE.normalMaterial(*args) + +def texture(*args): + return _P5_INSTANCE.texture(*args) + +def textureMode(*args): + return _P5_INSTANCE.textureMode(*args) + +def textureWrap(*args): + return _P5_INSTANCE.textureWrap(*args) + +def ambientMaterial(*args): + return _P5_INSTANCE.ambientMaterial(*args) + +def specularMaterial(*args): + return _P5_INSTANCE.specularMaterial(*args) + +def shininess(*args): + return _P5_INSTANCE.shininess(*args) + +def camera(*args): + return _P5_INSTANCE.camera(*args) + +def perspective(*args): + return _P5_INSTANCE.perspective(*args) + +def ortho(*args): + return _P5_INSTANCE.ortho(*args) + +def createCamera(*args): + return _P5_INSTANCE.createCamera(*args) + +def setCamera(*args): + return _P5_INSTANCE.setCamera(*args) + +def select(*args): + return _P5_INSTANCE.select(*args) + +def selectAll(*args): + return _P5_INSTANCE.selectAll(*args) + +def removeElements(*args): + return _P5_INSTANCE.removeElements(*args) + +def changed(*args): + return _P5_INSTANCE.changed(*args) + +def input(*args): + return _P5_INSTANCE.input(*args) + +def createDiv(*args): + return _P5_INSTANCE.createDiv(*args) + +def createP(*args): + return _P5_INSTANCE.createP(*args) + +def createSpan(*args): + return _P5_INSTANCE.createSpan(*args) + +def createImg(*args): + return _P5_INSTANCE.createImg(*args) + +def createA(*args): + return _P5_INSTANCE.createA(*args) + +def createSlider(*args): + return _P5_INSTANCE.createSlider(*args) + +def createButton(*args): + return _P5_INSTANCE.createButton(*args) + +def createCheckbox(*args): + return _P5_INSTANCE.createCheckbox(*args) + +def createSelect(*args): + return _P5_INSTANCE.createSelect(*args) + +def createRadio(*args): + return _P5_INSTANCE.createRadio(*args) + +def createColorPicker(*args): + return _P5_INSTANCE.createColorPicker(*args) + +def createInput(*args): + return _P5_INSTANCE.createInput(*args) + +def createFileInput(*args): + return _P5_INSTANCE.createFileInput(*args) + +def createVideo(*args): + return _P5_INSTANCE.createVideo(*args) + +def createAudio(*args): + return _P5_INSTANCE.createAudio(*args) + +def createCapture(*args): + return _P5_INSTANCE.createCapture(*args) + +def createElement(*args): + return _P5_INSTANCE.createElement(*args) + +def createCanvas(*args): + canvas = _P5_INSTANCE.createCanvas(*args) + + global width, height + width = _P5_INSTANCE.width + height = _P5_INSTANCE.height + + return canvas + +# Thanks to Luca Damasco for also helping us to +# figure out how to bind events functions. +def _bind_event_function(func, *args, **kwargs): + func = global_p5_injection(_P5_INSTANCE)(func) + try: + func(*args, **kwargs) # try to execute passing parameters + except TypeError: + func() # execute without parameters (are opitional) + +def __deviceMoved(e): + try: + _bind_event_function(deviceMoved, e) + except NameError: + pass + +def __deviceTurned(e): + try: + _bind_event_function(deviceTurned, e) + except NameError: + pass + +def __deviceShaken(e): + try: + _bind_event_function(deviceShaken, e) + except NameError: + pass + +def __touchEnded(e): + try: + _bind_event_function(deviceShaken, e) + except NameError: + pass + +def __touchStarted(e): + try: + _bind_event_function(touchStarted, e) + except NameError: + pass + +def __windowResized(e): + try: + _bind_event_function(windowResized, e) + except NameError: + pass + +def __touchMoved(e): + try: + _bind_event_function(touchMoved, e) + except NameError: + pass + +def __mouseMoved(e): + try: + _bind_event_function(mouseMoved, e) + except NameError: + pass + +def __mouseDragged(e): + try: + _bind_event_function(mouseDragged, e) + except NameError: + pass + +def __mousePressed(e): + try: + _bind_event_function(mousePressed, e) + except NameError: + pass + +def __mouseReleased(e): + try: + _bind_event_function(mouseReleased, e) + except NameError: + pass + +def __mouseClicked(e): + try: + _bind_event_function(mouseClicked, e) + except NameError: + pass + +def __doubleClicked(e): + try: + _bind_event_function(doubleClicked, e) + except NameError: + pass + +def __mouseWheel(e): + try: + _bind_event_function(mouseWheel, e) + except NameError: + pass + +def __keyPressed(e): + try: + _bind_event_function(keyPressed, e) + except NameError: + pass + +def __keyReleased(e): + try: + _bind_event_function(keyReleased, e) + except NameError: + pass + +def __keyTyped(e): + try: + _bind_event_function(keyTyped, e) + except NameError: + pass + +def __keyIsDown(e): + try: + _bind_event_function(keyIsDown, e) + except NameError: + pass + +def pop(*args): + p5_pop = _P5_INSTANCE.pop(*args) + return p5_pop + + +# Processing Python or Java mode compatibility aliases +size = createCanvas +popMatrix = pop +popStyle = pop +pushMatrix = push +pushStyle = push + +# PVector is a wrapper/helper class for p5.Vector objets +# providing names similar to Processing Python or Java modes +# but mostly keeping p5js functionality + +from numbers import Number + +class PVector: + + def __init__(self, x=0, y=0, z=0): + self.__vector = createVector(x, y, z) + self.add = self.__instance_add__ + self.sub = self.__instance_sub__ + self.mult = self.__instance_mult__ + self.div = self.__instance_div__ + self.cross = self.__instance_cross__ + self.dist = self.__instance_dist__ + self.dot = self.__instance_dot__ + self.lerp = self.__instance_lerp__ + + @property + def x(self): + return self.__vector.x + + @x.setter + def x(self, x): + self.__vector.x = x + + @property + def y(self): + return self.__vector.y + + @y.setter + def y(self, y): + self.__vector.y = y + + @property + def z(self): + return self.__vector.z + + @z.setter + def z(self, z): + self.__vector.z = z + + def mag(self): + return self.__vector.mag() + + def magSq(self): + return self.__vector.magSq() + + def setMag(self, mag): + self.__vector.setMag(mag) + return self + + def normalize(self): + self.__vector.normalize() + return self + + def limit(self, max): + self.__vector.limit(max) + return self + + def heading(self): + return self.__vector.heading() + + def rotate(self, angle): + self.__vector.rotate(angle) + return self + + def __instance_add__(self, *args): + if len(args) == 1: + return PVector.add(self, args[0], self) + else: + return PVector.add(self, PVector(*args), self) + + def __instance_sub__(self, *args): + if len(args) == 1: + return PVector.sub(self, args[0], self) + else: + return PVector.sub(self, PVector(*args), self) + + def __instance_mult__(self, o): + return PVector.mult(self, o, self) + + def __instance_div__(self, f): + return PVector.div(self, f, self) + + def __instance_cross__(self, o): + return PVector.cross(self, o, self) + + def __instance_dist__(self, o): + return PVector.dist(self, o) + + def __instance_dot__(self, *args): + if len(args) == 1: + v = args[0] + else: + v = args + return self.x * v[0] + self.y * v[1] + self.z * v[2] + + def __instance_lerp__(self, *args): + if len(args) == 2: + return PVector.lerp(self, args[0], args[1], self) + else: + vx, vy, vz, f = args + return PVector.lerp(self, PVector(vx, vy, vz), f, self) + + def get(self): + return PVector(self.x, self.y, self.z) + + def copy(self): + return PVector(self.x, self.y, self.z) + + def __getitem__(self, k): + return getattr(self, ('x', 'y', 'z')[k]) + + def __setitem__(self, k, v): + setattr(self, ('x', 'y', 'z')[k], v) + + def __copy__(self): + return PVector(self.x, self.y, self.z) + + def __deepcopy__(self, memo): + return PVector(self.x, self.y, self.z) + + def __repr__(self): # PROVISÓRIO + return f'PVector({self.x}, {self.y}, {self.z})' + + def set(self, *args): + """ + Sets the x, y, and z component of the vector using two or three separate + variables, the data from a p5.Vector, or the values from a float array. + """ + self.__vector.set(*args) + + @classmethod + def add(cls, a, b, dest=None): + if dest is None: + return PVector(a.x + b[0], a.y + b[1], a.z + b[2]) + dest.__vector.set(a.x + b[0], a.y + b[1], a.z + b[2]) + return dest + + @classmethod + def sub(cls, a, b, dest=None): + if dest is None: + return PVector(a.x - b[0], a.y - b[1], a.z - b[2]) + dest.__vector.set(a.x - b[0], a.y - b[1], a.z - b[2]) + return dest + + @classmethod + def mult(cls, a, b, dest=None): + if dest is None: + return PVector(a.x * b, a.y * b, a.z * b) + dest.__vector.set(a.x * b, a.y * b, a.z * b) + return dest + + @classmethod + def div(cls, a, b, dest=None): + if dest is None: + return PVector(a.x / b, a.y / b, a.z / b) + dest.__vector.set(a.x / b, a.y / b, a.z / b) + return dest + + @classmethod + def dist(cls, a, b): + return a.__vector.dist(b.__vector) + + @classmethod + def dot(cls, a, b): + return a.__vector.dot(b.__vector) + + def __add__(a, b): + return PVector.add(a, b, None) + + def __sub__(a, b): + return PVector.sub(a, b, None) + + def __isub__(a, b): + a.sub(b) + return a + + def __iadd__(a, b): + a.add(b) + return a + + def __mul__(a, b): + if not isinstance(b, Number): + raise TypeError( + "The * operator can only be used to multiply a PVector by a number") + return PVector.mult(a, float(b), None) + + def __rmul__(a, b): + if not isinstance(b, Number): + raise TypeError( + "The * operator can only be used to multiply a PVector by a number") + return PVector.mult(a, float(b), None) + + def __imul__(a, b): + if not isinstance(b, Number): + raise TypeError( + "The *= operator can only be used to multiply a PVector by a number") + a.__vector.mult(float(b)) + return a + + def __truediv__(a, b): + if not isinstance(b, Number): + raise TypeError( + "The * operator can only be used to multiply a PVector by a number") + return PVector(a.x / float(b), a.y / float(b), a.z / float(b)) + + def __itruediv__(a, b): + if not isinstance(b, Number): + raise TypeError( + "The /= operator can only be used to multiply a PVector by a number") + a.__vector.set(a.x / float(b), a.y / float(b), a.z / float(b)) + return a + + def __eq__(a, b): + return a.x == b[0] and a.y == b[1] and a.z == b[2] + + def __lt__(a, b): + return a.magSq() < b.magSq() + + def __le__(a, b): + return a.magSq() <= b.magSq() + + def __gt__(a, b): + return a.magSq() > b.magSq() + + def __ge__(a, b): + return a.magSq() >= b.magSq() + + # Problematic class methods, we would rather use p5.Vector when possible... + + @classmethod + def lerp(cls, a, b, f, dest=None): + v = createVector(a.x, a.y, a.z) + v.lerp(b.__vector, f) + if dest is None: + return PVector(v.x, v.y, v.z) + dest.set(v.x, v.y, v.z) + return dest + + @classmethod + def cross(cls, a, b, dest=None): + x = a.y * b[2] - b[1] * a.z + y = a.z * b[0] - b[2] * a.x + z = a.x * b[1] - b[0] * a.y + if dest is None: + return PVector(x, y, z) + dest.set(x, y, z) + return dest + + @classmethod + def fromAngle(cls, angle, length=1): + # https://github.com/processing/p5.js/blob/3f0b2f0fe575dc81c724474154f5b23a517b7233/src/math/p5.Vector.js + return PVector(length * cos(angle), length * sin(angle), 0) + + @classmethod + def fromAngles(theta, phi, length=1): + # https://github.com/processing/p5.js/blob/3f0b2f0fe575dc81c724474154f5b23a517b7233/src/math/p5.Vector.js + cosPhi = cos(phi) + sinPhi = sin(phi) + cosTheta = cos(theta) + sinTheta = sin(theta) + return PVector(length * sinTheta * sinPhi, + -length * cosTheta, + length * sinTheta * cosPhi) + + @classmethod + def random2D(cls): + return PVector.fromAngle(random(TWO_PI)) + + @classmethod + def random3D(cls, dest=None): + angle = random(TWO_PI) + vz = random(2) - 1 + mult = sqrt(1 - vz * vz) + vx = mult * cos(angle) + vy = mult * sin(angle) + if dest is None: + return PVector(vx, vy, vz) + dest.set(vx, vy, vz) + return dest + + @classmethod + def angleBetween(cls, a, b): + return acos(a.dot(b) / sqrt(a.magSq() * b.magSq())) + + # Other harmless p5js methods + + def equals(self, v): + return self == v + + def heading2D(self): + return self.__vector.heading() + + def reflect(self, *args): + # Reflect the incoming vector about a normal to a line in 2D, or about + # a normal to a plane in 3D This method acts on the vector directly + r = self.__vector.reflect(*args) + return r + + def array(self): + # Return a representation of this vector as a float array. This is only + # for temporary use. If used in any w fashion, the contents should be + # copied by using the p5.Vector.copy() method to copy into your own + # array. + return self.__vector.array() + + def toString(self): + # Returns a string representation of a vector v by calling String(v) or v.toString(). + # return self.__vector.toString() would be something like "p5.vector + # Object […, …, …]" + return str(self) + + def rem(self, *args): + # Gives remainder of a vector when it is divided by anw vector. See + # examples for more context. + self.__vector.rem(*args) + return self + + +def pre_draw(p5_instance, draw_func, *args, **kwargs): + """ + We need to run this before the actual draw to insert and update p5 env variables + """ + global _CTX_MIDDLE, _DEFAULT_FILL, _DEFAULT_LEADMULT, _DEFAULT_STROKE, _DEFAULT_TEXT_FILL + + global ADD, ALT, ARROW, AUTO, AUDIO, AXES, BACKSPACE, BASELINE, BEVEL, BEZIER, BLEND, BLUR, BOLD, BOLDITALIC + global BOTTOM, BURN, CENTER, CHORD, CLAMP, CLOSE, CONTROL, CORNER, CORNERS, CROSS, CURVE, DARKEST + global DEG_TO_RAD, DEGREES, DELETE, DIFFERENCE, DILATE, DODGE, DOWN_ARROW, ENTER, ERODE, ESCAPE, EXCLUSION + global FILL, GRAY, GRID, HALF_PI, HAND, HARD_LIGHT, HSB, HSL, IMAGE, IMMEDIATE, INVERT, ITALIC, LANDSCAPE + global LEFT, LEFT_ARROW, LIGHTEST, LINE_LOOP, LINE_STRIP, LINEAR, LINES, MIRROR, MITER, MOVE, MULTIPLY, NEAREST + global NORMAL, OPAQUE, OPEN, OPTION, OVERLAY, P2D, P3D, PI, PIE, POINTS, PORTRAIT, POSTERIZE, PROJECT, QUAD_STRIP + global QUADRATIC, QUADS, QUARTER_PI, RAD_TO_DEG, RADIANS, RADIUS, REPEAT, REPLACE, RETURN, RGB, RIGHT, RIGHT_ARROW + global ROUND, SCREEN, SHIFT, SOFT_LIGHT, SQUARE, STROKE, SUBTRACT, TAB, TAU, TEXT, TEXTURE, THRESHOLD, TOP + global TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP_ARROW, VIDEO, WAIT, WEBGL + + global frameCount, focused, displayWidth, displayHeight, windowWidth, windowHeight, width, height + global deviceOrientation, accelerationX, accelerationY, accelerationZ + global pAccelerationX, pAccelerationY, pAccelerationZ, rotationX, rotationY, rotationZ + global pRotationX, pRotationY, pRotationZ, turnAxis, keyIsPressed, key, keyCode, mouseX, mouseY, pmouseX, pmouseY + global winMouseX, winMouseY, pwinMouseX, pwinMouseY, mouseButton, mouseIsPressed, touches, pixels + + _CTX_MIDDLE = p5_instance._CTX_MIDDLE + _DEFAULT_FILL = p5_instance._DEFAULT_FILL + _DEFAULT_LEADMULT = p5_instance._DEFAULT_LEADMULT + _DEFAULT_STROKE = p5_instance._DEFAULT_STROKE + _DEFAULT_TEXT_FILL = p5_instance._DEFAULT_TEXT_FILL + + ADD = p5_instance.ADD + ALT = p5_instance.ALT + ARROW = p5_instance.ARROW + AUDIO = p5_instance.AUDIO + AUTO = p5_instance.AUTO + AXES = p5_instance.AXES + BACKSPACE = p5_instance.BACKSPACE + BASELINE = p5_instance.BASELINE + BEVEL = p5_instance.BEVEL + BEZIER = p5_instance.BEZIER + BLEND = p5_instance.BLEND + BLUR = p5_instance.BLUR + BOLD = p5_instance.BOLD + BOLDITALIC = p5_instance.BOLDITALIC + BOTTOM = p5_instance.BOTTOM + BURN = p5_instance.BURN + CENTER = p5_instance.CENTER + CHORD = p5_instance.CHORD + CLAMP = p5_instance.CLAMP + CLOSE = p5_instance.CLOSE + CONTROL = p5_instance.CONTROL + CORNER = p5_instance.CORNER + CORNERS = p5_instance.CORNERS + CROSS = p5_instance.CROSS + CURVE = p5_instance.CURVE + DARKEST = p5_instance.DARKEST + DEG_TO_RAD = p5_instance.DEG_TO_RAD + DEGREES = p5_instance.DEGREES + DELETE = p5_instance.DELETE + DIFFERENCE = p5_instance.DIFFERENCE + DILATE = p5_instance.DILATE + DODGE = p5_instance.DODGE + DOWN_ARROW = p5_instance.DOWN_ARROW + ENTER = p5_instance.ENTER + ERODE = p5_instance.ERODE + ESCAPE = p5_instance.ESCAPE + EXCLUSION = p5_instance.EXCLUSION + FILL = p5_instance.FILL + GRAY = p5_instance.GRAY + GRID = p5_instance.GRID + HALF_PI = p5_instance.HALF_PI + HAND = p5_instance.HAND + HARD_LIGHT = p5_instance.HARD_LIGHT + HSB = p5_instance.HSB + HSL = p5_instance.HSL + IMAGE = p5_instance.IMAGE + IMMEDIATE = p5_instance.IMMEDIATE + INVERT = p5_instance.INVERT + ITALIC = p5_instance.ITALIC + LANDSCAPE = p5_instance.LANDSCAPE + LEFT = p5_instance.LEFT + LEFT_ARROW = p5_instance.LEFT_ARROW + LIGHTEST = p5_instance.LIGHTEST + LINE_LOOP = p5_instance.LINE_LOOP + LINE_STRIP = p5_instance.LINE_STRIP + LINEAR = p5_instance.LINEAR + LINES = p5_instance.LINES + MIRROR = p5_instance.MIRROR + MITER = p5_instance.MITER + MOVE = p5_instance.MOVE + MULTIPLY = p5_instance.MULTIPLY + NEAREST = p5_instance.NEAREST + NORMAL = p5_instance.NORMAL + OPAQUE = p5_instance.OPAQUE + OPEN = p5_instance.OPEN + OPTION = p5_instance.OPTION + OVERLAY = p5_instance.OVERLAY + P2D = p5_instance.P2D + P3D = p5_instance.WEBGL + PI = p5_instance.PI + PIE = p5_instance.PIE + POINTS = p5_instance.POINTS + PORTRAIT = p5_instance.PORTRAIT + POSTERIZE = p5_instance.POSTERIZE + PROJECT = p5_instance.PROJECT + QUAD_STRIP = p5_instance.QUAD_STRIP + QUADRATIC = p5_instance.QUADRATIC + QUADS = p5_instance.QUADS + QUARTER_PI = p5_instance.QUARTER_PI + RAD_TO_DEG = p5_instance.RAD_TO_DEG + RADIANS = p5_instance.RADIANS + RADIUS = p5_instance.RADIUS + REPEAT = p5_instance.REPEAT + REPLACE = p5_instance.REPLACE + RETURN = p5_instance.RETURN + RGB = p5_instance.RGB + RIGHT = p5_instance.RIGHT + RIGHT_ARROW = p5_instance.RIGHT_ARROW + ROUND = p5_instance.ROUND + SCREEN = p5_instance.SCREEN + SHIFT = p5_instance.SHIFT + SOFT_LIGHT = p5_instance.SOFT_LIGHT + SQUARE = p5_instance.SQUARE + STROKE = p5_instance.STROKE + SUBTRACT = p5_instance.SUBTRACT + TAB = p5_instance.TAB + TAU = p5_instance.TAU + TEXT = p5_instance.TEXT + TEXTURE = p5_instance.TEXTURE + THRESHOLD = p5_instance.THRESHOLD + TOP = p5_instance.TOP + TRIANGLE_FAN = p5_instance.TRIANGLE_FAN + TRIANGLE_STRIP = p5_instance.TRIANGLE_STRIP + TRIANGLES = p5_instance.TRIANGLES + TWO_PI = p5_instance.TWO_PI + UP_ARROW = p5_instance.UP_ARROW + VIDEO = p5_instance.VIDEO + WAIT = p5_instance.WAIT + WEBGL = p5_instance.WEBGL + + frameCount = p5_instance.frameCount + focused = p5_instance.focused + displayWidth = p5_instance.displayWidth + displayHeight = p5_instance.displayHeight + windowWidth = p5_instance.windowWidth + windowHeight = p5_instance.windowHeight + width = p5_instance.width + height = p5_instance.height + deviceOrientation = p5_instance.deviceOrientation + accelerationX = p5_instance.accelerationX + accelerationY = p5_instance.accelerationY + accelerationZ = p5_instance.accelerationZ + pAccelerationX = p5_instance.pAccelerationX + pAccelerationY = p5_instance.pAccelerationY + pAccelerationZ = p5_instance.pAccelerationZ + rotationX = p5_instance.rotationX + rotationY = p5_instance.rotationY + rotationZ = p5_instance.rotationZ + pRotationX = p5_instance.pRotationX + pRotationY = p5_instance.pRotationY + pRotationZ = p5_instance.pRotationZ + turnAxis = p5_instance.turnAxis + keyIsPressed = p5_instance.keyIsPressed + key = p5_instance.key + keyCode = p5_instance.keyCode + mouseX = p5_instance.mouseX + mouseY = p5_instance.mouseY + pmouseX = p5_instance.pmouseX + pmouseY = p5_instance.pmouseY + winMouseX = p5_instance.winMouseX + winMouseY = p5_instance.winMouseY + pwinMouseX = p5_instance.pwinMouseX + pwinMouseY = p5_instance.pwinMouseY + mouseButton = p5_instance.mouseButton + mouseIsPressed = p5_instance.mouseIsPressed + touches = p5_instance.touches + pixels = p5_instance.pixels + + return draw_func(*args, **kwargs) + + +def global_p5_injection(p5_sketch): + """ + Injects the p5js's skecth instance as a global variable to setup and draw functions + """ + + def decorator(f, *args, **kwargs): + def wrapper(*args, **kwargs): + global _P5_INSTANCE + _P5_INSTANCE = p5_sketch + return pre_draw(_P5_INSTANCE, f, *args, **kwargs) + + + return wrapper + + + return decorator + + +def start_p5(setup_func, draw_func, event_functions): + """ + This is the entrypoint function. It accepts 2 parameters: + + - setup_func: a Python setup callable + - draw_func: a Python draw callable + - event_functions: a config dict for the event functions in the format: + {"eventFunctionName": python_event_function} + + This method gets the p5js's sketch instance and injects them + """ + + def sketch_setup(p5_sketch): + """ + Callback function called to configure new p5 instance + """ + p5_sketch.setup = global_p5_injection(p5_sketch)(setup_func) + p5_sketch.draw = global_p5_injection(p5_sketch)(draw_func) + # Register event functions + p5_sketch.mouseDragged = lambda e: __mouseDragged(e) + p5_sketch.deviceMoved= lambda e: __deviceMoved(e) + p5_sketch.deviceTurned= lambda e: __deviceTurned(e) + p5_sketch.deviceShaken= lambda e: __deviceShaken(e) + p5_sketch.touchStarted= lambda e: __touchStarted(e) + p5_sketch.touchMoved= lambda e: __touchMoved(e) + p5_sketch.touchEnded= lambda e: __touchEnded(e) + p5_sketch.windowResized = lambda e: __windowResized (e) + p5_sketch.mouseMoved = lambda e: __mouseMoved(e) + p5_sketch.mouseDragged = lambda e: __mouseDragged(e) + p5_sketch.mousePressed = lambda e: __mousePressed(e) + p5_sketch.mouseReleased = lambda e: __mouseReleased(e) + p5_sketch.mouseClicked = lambda e: __mouseClicked(e) + p5_sketch.doubleClicked = lambda e: __doubleClicked(e) + p5_sketch.mouseWheel = lambda e: __mouseWheel(e) + p5_sketch.keyTyped = lambda e: __keyTyped(e) + p5_sketch.keyPressed = lambda e: __keyPressed(e) + p5_sketch.keyReleased = lambda e: __keyReleased(e) + p5_sketch.keyIsDown = lambda e: __keyIsDown(e) # TODO review this func + + + window.instance = p5.new(sketch_setup, 'sketch-holder') +`; + +let placeholder = ` +def setup(): + pass + +def draw(): + pass +`; + +let userCode = ` +def setup(): + createCanvas(200, 200) + +def draw(): + background(200) + diameter = sin(frameCount / 60) * 50 + 50 + fill("blue") + ellipse(100, 100, diameter, diameter) + +`; + +function runCode() { + let code = [ + placeholder, + userCode, + wrapper_content, + 'start_p5(setup, draw, {});', + ].join('\n'); + + if (window.instance) { + window.instance.canvas.remove(); + } + + console.log("Python execution output:"); + window.pyodide.runPython(code); +} + + +async function main() { + const config = { + indexURL : "https://pyodide-cdn2.iodide.io/v0.18.1/full/", + fullStdLib: false, + } + window.pyodide = await loadPyodide(config); + // Pyodide is now ready to use... + console.log(window.pyodide.runPython(` + import io, code, sys + from js import p5, window, document + print(sys.version) + `)); + window.runSketchCode = (code) => { + userCode = code; + runCode(); + } + + runCode(); +}; + +main(); \ No newline at end of file diff --git a/pyp5js/cli.py b/pyp5js/cli.py index c832b328..fc89898a 100755 --- a/pyp5js/cli.py +++ b/pyp5js/cli.py @@ -60,13 +60,14 @@ def transcrypt_sketch(sketch_name): @command_line_entrypoint.command("compile") @click.argument("sketch_name") @click.option('--refresh', is_flag=True, help="Update the skech index.html before it ends.") -def compile_sketch(sketch_name, refresh): +@click.option('--template', '-t', type=click.Path(exists=True), help='Specify a custom index.html template to use. Must be used with --refresh in order to work.') +def compile_sketch(sketch_name, refresh, template): """ Command to update your sketch files (index, js codes etc) \nExample: $ pyp5js compile my_sketch """ - files = commands.compile_sketch(sketch_name.replace("/", ""), refresh) + files = commands.compile_sketch(sketch_name.replace("/", ""), refresh, template) cprint.ok(f"Your sketch is ready and available at file://{files.index_html.absolute()}") diff --git a/pyp5js/commands.py b/pyp5js/commands.py index c6d04e84..b7a5c0f2 100644 --- a/pyp5js/commands.py +++ b/pyp5js/commands.py @@ -42,7 +42,7 @@ def new_sketch(sketch_name, interpreter=PYODIDE_INTERPRETER, template_file=""): return sketch -def compile_sketch(sketch_name, generate_index=False): +def compile_sketch(sketch_name, generate_index=False, index_template=None): """ Transcrypt the sketch python code to javascript. @@ -61,6 +61,9 @@ def compile_sketch(sketch_name, generate_index=False): compile_sketch_js(sketch) if generate_index: + # to be able to overwrite default index template file + # useful for generating the docs or debugging + sketch.config.index_template = index_template index_contet = get_sketch_index_content(sketch) with open(sketch.index_html, "w") as fd: fd.write(index_contet) diff --git a/pyp5js/http/templates/view_sketch.html b/pyp5js/http/templates/view_sketch.html index 7f1fc547..dab7d969 100644 --- a/pyp5js/http/templates/view_sketch.html +++ b/pyp5js/http/templates/view_sketch.html @@ -15,42 +15,87 @@ } pre { - margin-right: 2em; + margin-right: 2em; + } + + .text-editor-box { + margin: 0 1.5em; + max-width: 800px; + display: flex; + flex-direction: column; + align-items: flex-end; } #text-editor { - width: 700px; - height: 800px; - float: left; - margin: 1.5em; + float: left; + margin: 0.5em 0; + height: 800px; + } + + .text-editor { + width: 700px; + transition-property: width; + transition: 500ms ease-out; } #sketch-buttons { - margin: 0 1.5em; + width: 100%; + min-width: 250px; + display: flex; + justify-content: space-between; + align-self: flex-start; + } + + .left-buttons { + width: 100%; + } + + .hidden-editor { + opacity: 0.2; + width: 250px; + transition-property: width; + transition: 500ms ease-in; } + + .code-container { + display: flex; + align-items: flex-start; + justify-content: flex-start; + } + {% endblock %} {% block content %}
- +
- Back to sketchbook -
- - -
{{ py_code }}
- -
- {% if live_run %} - - - {% endif %} - + Back to sketchbook + + +
+
+ +
{{ py_code }}
+
+ {% if live_run %} +
+ + +
+ {% endif %} + +
- +
+
- +
@@ -58,7 +103,6 @@ {% endblock content %} {% block custom_js %} -