Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

1

Малювання за допомогою черепашки

Образи черепашки

t.shape("назва образу")
Можливі варіанти: ​“arrow”, “turtle”, “circle”, “square”, “triangle”, “classic”

Стан черепашки під час малювання:

● t.​
pendown()
t.​
pd()
t.​
down()
● Малювати під час руху
● Pull the pen down – drawing when moving.

● t.​
penup()
t.​
pu()
t.​
up()

● НЕ​малювати під час руху


● Pull the pen up – no drawing when moving.

● t.​
width​(​n​)
t.​
pen_size​(​n​)
● товщина лінії ​n
● Set the line thickness to ​n​or return it

Управління кольором:

t.​
pencolor​
(​colorstring​)

● малювати кольором ​colorstring


● use pen with color ​colorstring

● turtle.​begin_fill​()
● Викликати перед малюванням фігури з кольором усередині
● To be called just before drawing a shape to be filled.

● turtle.​end_fill​()
● Викликати після малюванням фігури з кольором усередині
● Fill the shape drawn after the last call to begin_fill().

Карти кольорів:

http://www.science.smith.edu/dftwiki/index.php/Color_Charts_for_TKinter
http://cng.seas.rochester.edu/CNG/docs/x11color.html

Створити малюнок:
2

import turtle
t = turtle.Pen()
t.shape('square')
t.speed(1)

t.left(90)
t.pensize(60)
t.pencolor('red')
t.forward(100)
t.penup()
t.forward(50)
t.pendown()
t.pencolor('yellow')
t.dot(40)
t.pensize(5)
t.pencolor('black')
t.back(15)

t.hideturtle()

Створити малюнок:

import turtle
t = turtle.Pen()
t.pencolor('sandybrown')
t.fillcolor('sandybrown')
3

t.begin_fill()

t.left(90)
t.forward(100)
t.right(45)
t.forward(72)
t.right(90)
t.forward(72)
t.right(45)
t.forward(100)

t.end_fill()

t.hideturtle()

Намалювати фігури:
1.

2.

3.
4

You might also like