Coder Social home page Coder Social logo

playing-turtle's Introduction

Playing with Python Turtle

Teenage Mutant Ninja Turtles

Turtle is a python module, it allows you to draw shapes on the screen. You control a cursor that you can move with the commands:

import turtle

turtle.forward(10) # 10 moves forward
turtle.backward(10) # 10 moves backward
turtle.left(90) # rotates 90 degrees cursor left
turtle.right(90) # clockwise

turtle.penup() # cursor up
turtle.pendown() # cursor down

Here is an example of a program drawing a square:

import turtle
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(90)

A bit of style

You can customize your designs with different functions:

turtle.speed(speed) # changes the cursor speed
turtle.pensize(size) # changes the size of the line
turtle.pencolor(red, green, blue)
# each component is between 0 and 1

Installation

sudo apt-get install python python-tk

playing-turtle's People

Contributors

yvan-sraka avatar

Watchers

James Cloos avatar suliman 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.