Turtle graphics on the web.
Project description
Tortoise: turtle graphics on the web
This repository is the proof of concept of an implementation, in Python, of turtle graphics based on web technologies. This is the main difference with the turtle module, which uses (t|T)kinter.
Cloning the repository (or retrieving the corresponding ZIP file) is sufficient to use this module. The main.py
file, with which above picture were generated, is an example of use of this library. Simply launch python main.py
from the root of the repository.
The module is also available on Pypi: https://pypi.org/project/tortoise/. Simply launch pip install tortoise
to install it.
You can also test the library directly in your web browser, with nothing to install: http://q37.info/s/dj9b7ksf.
This Python module is part of a larger project that aims to provide a way to write modern examples or exercises for programming tutorials.
The tortoise library currently provides following methods (coordinates and distances are relative to the viewbox of the SVG):
- constructor
(dom,id)
: returns a tortoise object which usesdom
as the DOM from the Atlas toolkit, and the SVG element of idid
, getAngle()
: returns the current angel, in degrees,up()
: puts the pen up,down()
: puts the pen down,setAutoDraw(value)
: the drawing is automatically rendered eachvalue
movements (0
will disable the auto draw); calldraw()
to render remaining movements,setPosition(x,y)
: the turtle jumps to positionx
andy
,forward(distance)
: the tortoise moves by the specifieddistance
,right(angle)
: the tortoise turns clockwise fromangle
degrees,left(angle)
: the tortoise turns counter clockwise fromangle
degrees,setColorRGB(r,g,b)
: sets the color of the pen following the RGB color model,setColorHSL(h,s,l)
: sets the color of the pen following the HSL color model, (h
: 0 - 360;s
,l
: 0 - 100%),draw()
: draws remaining movements,clear()
: erase the drawing area and also resets the internal settings (coordinates, angle, color…).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tortoise-0.1.1.tar.gz
.
File metadata
- Download URL: tortoise-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4ebd69b152d266174b3b0f2a22e3fb8995101eb749d3114813a98f405ab10bb |
|
MD5 | 7275ac9c80517bb9653c053243d5cca2 |
|
BLAKE2b-256 | 8b98970d10bcc02eda8370c425dd6306526eec8b407aa83f13bb0ebe7da41012 |
File details
Details for the file tortoise-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: tortoise-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcb58a56d6796cad0db330104450df2caf2ea9e98d844bb2906274bd15c12804 |
|
MD5 | 3db863f17eb2bea0619d92d20631d1e3 |
|
BLAKE2b-256 | 16efb314819f12e48e7a99f07825d064b596d58cc4a0c3b75939d0d10fedf90d |