Python Turtle Manuale Sintetico

Un manuale sintetico per chi vuole divertirsi con Python e Turtle. Stampa il PDF annesso e tienilo con te sulla scrivania o tavolo a scuola per ricordare al volo i principali comandi.

Python Turtle Manuale Sintetico

Da inserire all’inizio sempre:

import turtle

tarta = turtle.Turtle()

tarta.shape(‘turtle’) scegli arrow, square, circle, triangle e classic

tarta.up():  alza la penna per non disegnare

tarta.down(): abbassa la penna per disegnare

tarta.right(angolo):  gira il muso a destra dell’angolo indicato

tarta.left(angolo): gira il muso a destra dell’angolo indicato

tarta.forward(pixel):  si muove in avanti di un numero di pixel

tarta.backward(pixel):  si muove indietro di un numero di pixel

tarta.goto(x,y): muove il cursore in specifico punto

tarta.home(): torna al centro 0,0

tarta.color(r,g,b), tarta.color(s) / tarta.fillcolor(r,g,b), tarta.fillcolor(s): colora la linea o riempie col colore scelto

tarta.circle(radius): disegna un cerchio del raggio indicato

tarta.begin_fill()

tarta.end_fill(): Si mettono ad inizio e fine di una figura per riempirla dell’ultimo colore impostato

tarta.speed(velocità): imposta la velocità in ms

tarta.pensize(spessore): imposta il tratto della penna

tarta.hideturtle()

tarta.showturtle(): nasconde o mostra il cursore

tarta.xcor(), tarta.ycor(): ritorna la posizione della tartaruga

tarta.bye(): chiude la finestra del disegno

tarta.setheading(angolo): Imposta la direzione. Le direzioni più comuni: 0 (est), 90 (nord), 180 (ovest), 270 (sud)

Esempio di ciclo

for i in range(4):

     tarta.right(90)

     tarta.forward(50)

Esempi di scelte random/casuali

random = random.randit(1,10)  colore= random.choice([‘red’,’green’,’blue’])

COLORI DISPONIBILI

chartreuse2

chartreuse3 DarkOrchid4

DarkRed goldenrod2

goldenrod3 LightBlue2

LightBlue3

AliceBlue

AntiqueWhite chartreuse4

chocolate DarkSalmon

DarkSeaGreen goldenrod4

green LightBlue4

LightCoral

AntiqueWhite1

AntiqueWhite2 chocolate1

chocolate2 DarkSeaGreen1

DarkSeaGreen2 green1

green2 LightCyan

LightCyan1

AntiqueWhite3

AntiqueWhite4

aquamarine chocolate3

chocolate4

coral DarkSeaGreen3

DarkSeaGreen4

DarkSlateBlue green3

green4

GreenYellow LightCyan2

LightCyan3

LightCyan4

aquamarine1

aquamarine2 coral1

coral2 DarkSlateGray

DarkSlateGray1 grey

greyX LightGoldenrod

aquamarine3

aquamarine4 coral3

coral4 DarkSlateGray2

DarkSlateGray3 honeydew

honeydew1 LightGoldenrod1

LightGoldenrod2

azure

azure1 CornflowerBlue

cornsilk DarkSlateGray4

DarkSlateGrey honeydew2

honeydew3 LightGoldenrod3

LightGoldenrod4

azure2

azure3

azure4 cornsilk1

cornsilk2

cornsilk3 DarkTurquoise

DarkViolet

DeepPink honeydew4

HotPink

HotPink1 LightGreen

LightGrey

LightPink

beige

bisque cornsilk4

cyan DeepPink1

DeepPink2 HotPink2

HotPink3 LightPink1

LightPink2

bisque1

bisque2 cyan1

cyan2 DeepPink3

DeepPink4 HotPink4

IndianRed LightPink3

LightPink4

bisque3

bisque4 cyan3

cyan4 DeepSkyBlue

DeepSkyBlue1 IndianRed1

IndianRed2 LightSalmon

LightSalmon1

black

blanchedalmond

BlanchedAlmond DarkBlue

DarkCyan

DarkGoldenrod DeepSkyBlue2

DeepSkyBlue3

DeepSkyBlue4 IndianRed3

IndianRed4

ivory LightSalmon2

LightSalmon3

LightSalmon4

blue

blue1 DarkGoldenrod1

DarkGoldenrod2 DimGray

DimGrey ivory1

ivory2 LightSeaGreen

LightSkyBlue

blue2

blue3 DarkGoldenrod3

DarkGoldenrod4 DodgerBlue

DodgerBlue1 ivory3

ivory4 LightSkyBlue1

LightSkyBlue2

blue4

BlueViolet DarkGray

DarkGreen DodgerBlue2

DodgerBlue3 khaki

khaki1 LightSkyBlue3

LightSkyBlue4

brown

brown1

brown2 DarkGrey

DarkKhaki

DarkMagenta DodgerBlue4

firebrick

firebrick1 khaki2

khaki3

khaki4 LightSlateBlue

LightSlateGrey

LightSteelBlue

brown3

brown4 DarkOliveGreen

DarkOliveGreen1 firebrick2

firebrick3 lavender

LavenderBlush LightSteelBlue1

LightSteelBlue2

burlywood

burlywood1 DarkOliveGreen2

DarkOliveGreen3 firebrick4

FloralWhite LavenderBlush1

LavenderBlush2 LightSteelBlue3

LightSteelBlue4

burlywood2

burlywood3

burlywood4 DarkOliveGreen4

DarkOrange

DarkOrange1 ForestGreen

gainsboro

GhostWhite LavenderBlush3

LavenderBlush4

LawnGreen LightYellow

LightYellow1

LightYellow2

CadetBlue

CadetBlue1 DarkOrange2

DarkOrange3 gold

gold1 LemonChiffon

LemonChiffon1 LightYellow3

LightYellow4

CadetBlue2

CadetBlue3 DarkOrange4

DarkOrchid gold2

gold3 LemonChiffon2

LemonChiffon3 LimeGreen

linen

CadetBlue4

chartreuse DarkOrchid1

DarkOrchid2 gold4

goldenrod LemonChiffon4

LightBlue magenta

magenta1

chartreuse1 DarkOrchid3 goldenrod1 LightBlue1 magenta2

X can be any integer between 1 & 100magenta3

magenta4 OrangeRed1

OrangeRed2 red2

red3 snow3

snow4

maroon

maroon1 OrangeRed3

OrangeRed4 red4

RosyBrown SpringGreen

SpringGreen1

maroon2

maroon3 orchid

orchid1 RosyBrown1

RosyBrown2 SpringGreen2

SpringGreen3

maroon4

MediumAquamarine orchid2

orchid3 RosyBrown3

RosyBrown4 SpringGreen4

SteelBlue

MediumBlue

MediumOrchid

MediumOrchid1 orchid4

PaleGoldenrod

PaleGreen RoyalBlue

RoyalBlue1

RoyalBlue2 SteelBlue1

SteelBlue2

SteelBlue3

MediumOrchid2

MediumOrchid3 PaleGreen1

PaleGreen2 RoyalBlue3

RoyalBlue4 SteelBlue4

tan

MediumOrchid4

MediumPurple PaleGreen3

PaleGreen4 SaddleBrown

salmon tan1

tan2

MediumPurple1

MediumPurple2 PaleTurquoise

PaleTurquoise1 salmon1

salmon2 tan3

tan4

MediumPurple3

MediumPurple4

MediumSeaGreen PaleTurquoise2

PaleTurquoise3

PaleTurquoise4 salmon3

salmon4

SandyBrown thistle

thistle1

thistle2

MediumSlateBlue

MediumSpringGreen PaleVioletRed

PaleVioletRed1 SeaGreen

SeaGreen1 thistle3

thistle4

MediumTurquoise

MediumVioletRed PaleVioletRed2

PaleVioletRed3 SeaGreen2

SeaGreen3 tomato

tomato1

MidnightBlue

MintCream

MistyRose PaleVioletRed4

PapayaWhip

PeachPuff SeaGreen4

seashell

seashell1 tomato2

tomato3

tomato4

MistyRose1

MistyRose2 PeachPuff1

PeachPuff2 seashell2

seashell3 turquoise

turquoise1

MistyRose3

MistyRose4 PeachPuff3

PeachPuff4 seashell4

sienna turquoise2

turquoise3

moccasin

NavajoWhite peru

pink sienna1

sienna2 turquoise4

violet

NavajoWhite1

NavajoWhite2

NavajoWhite3 pink1

pink2

pink3 sienna3

sienna4

SkyBlue VioletRed

VioletRed1

VioletRed2

NavajoWhite4

NavyBlue pink4

plum SkyBlue1

SkyBlue2 VioletRed3

VioletRed4

OldLace

OliveDrab plum1

plum2 SkyBlue3

SkyBlue4 wheat

wheat1

OliveDrab1

OliveDrab2 plum3

plum4 SlateBlue

SlateBlue1 wheat2

wheat3

OliveDrab3

OliveDrab4

orange PowderBlue

purple

purple1 SlateBlue2

SlateBlue3

SlateBlue4 wheat4

white

WhiteSmoke

orange1

orange2 purple2

purple3 SlateGrey

snow yellow

yellow1

orange3

orange4 purple4

red snow1

snow2 yellow2

yellow3

OrangeRed red1 snow3 yellow4  YellowGreen

 

Ultima modifica 25 Febbraio 2022