Giter VIP home page Giter VIP logo

tortoise-python's Introduction

Tortoise: turtle graphics on the web

Run on Repl.it About online demonstrations

license: MIT Version

tortoise library example

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.

Alternatively, you can also use Repl.it, so you have nothing to install on your computer. Follow this link, click on the green run button, and then click on (or scan) the then displayed QR code.

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 uses dom as the DOM from the Atlas toolkit, and the SVG element of id id,
  • getAngle(): returns the current angel, in degrees,
  • up(): puts the pen up,
  • down(): puts the pen down,
  • setAutoDraw(value): the drawing is automatically rendered each value movements (0 will disable the auto draw); call draw() to render remaining movements,
  • setPosition(x,y): the turtle jumps to position x and y,
  • forward(distance): the tortoise moves by the specified distance,
  • right(angle): the tortoise turns clockwise from angle degrees,
  • left(angle): the tortoise turns counter clockwise from angle 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…).

tortoise-python's People

Contributors

epeios-q37 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.