Пример #1
0
from turtle import Pen
from time import sleep


pen = Pen()

pen.right(60)
pen.forward(60)
pen.right(120)
pen.forward(60)
pen.right(120)
pen.forward(60)
pen.left(120)
pen.up()
pen.forward(55)
pen.down()

for i in range(4):
	pen.forward(35)
	pen.up()
	pen.forward(15)
	pen.left(90)
	pen.forward(15)
	pen.down()

pen.forward(15)
pen.right(90)
pen.up()
pen.forward(10)
pen.down()
pen.forward(120)
Пример #2
0
from turtle import Pen
from time import sleep

Karen = Pen()
Peter = Pen()
Bob = Pen()
Govno = Pen()

Karen.forward(120)
Peter.forward(120)

Bob.forward(140)
Govno.forward(140)

Karen.left(90)
Peter.right(90)

Bob.left(90)
Govno.right(90)

Karen.forward(60)
Peter.forward(60)

Bob.forward(30)
Govno.forward(30)

Karen.right(90)
Peter.left(90)

Bob.right(90)
Govno.left(90)
Пример #3
0
def step(t: turtle.Pen):
    t.penup()
    t.forward(i)
    t.left(46)
    t.pendown()
    t.dot(4 + i / 16)
Пример #4
0
from time import sleep

t1 = Pen()
t2 = Pen()

t1.up()
t2.up()

t1.right(90)
t2.right(90)

for i in range(25):
    t1.forward(8)
    t2.forward(8)

t1.left(90)

t1.down()
t2.down()

t2.right(90)
t2.forward(200)

for i in range(15):
    t1.forward(6)
    t2.forward(6)
    t1.left(6)
    t2.right(6)

for i in range(6):
    t1.forward(6)
Пример #5
0
#!/usr/bin/env python

from turtle import Pen, bgcolor, pencolor, forward, left, width
from time import sleep

bgcolor("black") #set canvas background color
colors = ["red", "green", "orange", "purple", "yellow", "blue"]
canvas = Pen()

for num in xrange(360):
	canvas.pencolor(colors[num % 6])
	canvas.width(num / 100 + 1) #to give the effect of the line getting bigger as it "approaches"
	canvas.forward(num) #so line length keeps increasing
	canvas.left(59) 
	
sleep(500) #so we have some time to admire the artwork, before it closes automatically
Пример #6
0
from turtle import Pen
from time import sleep

pen = Pen()

pen.up()
pen.forward(150)
pen.down()

for i in range(4):
    pen.forward(100)
    pen.left(90)

sleep(1)

pen2 = Pen()

pen2.forward(80)
pen2.up()
pen2.right(90)
pen2.forward(20)
pen2.down()
pen2.right(90)
pen2.forward(80)

sleep(4)
Пример #7
0
from  turtle import Pen 

t=Pen()
colors=['red','blue','black','green']
for i in  colors:
    t.pencolor(i)
    t.forward(100)
    t.left(90)
Пример #8
0
class Personagem:
    def __init__(self, nome = str, exibir=True):
        self._img = Pen()
        self._img.up()        
        self._img.shape(nome+'.gif')
        print(nome+'.gif')
        self._img.speed('fastest')
        self._caneta = Pen()
        self._caneta.hideturtle()
        self._caneta.pensize(2)
        self._caneta.color('white')
        if not exibir:
            self._img.hideturtle()
        


    def esconder(self):
        self._img.hideturtle()

    def exibir(self):
        self._img.showturtle()
                
    def falar(self, mensagem = str):
        #mensagem = formata(mensagem)
        x,y = self._img.position()
        self._caneta.up()
        self._caneta.goto(x,y)
        self._caneta.down()
        self._caneta.goto(x+100,y+100)
        self._caneta.write(mensagem)
        time.sleep(4)
        self._caneta.clear()


    def andar_direita(self, distancia = int):
        self._img.forward(distancia)

    def andar_esquerda(self, distancia = int):
        self._img.left(180)
        self._img.forward(distancia)
        
    def vapara (self, x = int, y = int):
        self._img.goto(x, y)


    def pular_cima (self):
        x,y = self._img.position()
        self._img.goto(x, y+100)
        time.sleep(0.5)
        self._img.goto(x+50, y-100)


    def pular_tras (self):
        x,y = self._img.position()
        self._img.goto(x-100, y+100)
        time.sleep(0.5)
        self._img.goto(x-100, y-100)


    def pular_frente (self):
        x,y = self._img.position()
        self._img.goto(x+100, y+100)
        time.sleep(0.5)
        self._img.goto(x+100, y-100)

    def posicao(self):
        return self._img.position()
            
        
    def lancar(self, vx = int, vy = int):
        x,y = self.posicao()
        for i in range(20):          
            self.vapara(x+i*vx, y+i*vy)
            vy -= 1
Пример #9
0
from turtle import Pen
from time import sleep

t1 = Pen()
t2 = Pen()

t1.up()
t2.up()

t1.right(90)
t2.right(90)
t1.forward(200)
t2.forward(200)

t1.left(90)

t1.down()
t2.down()

t2.right(90)
t2.forward(200)

t1.left(45)
t2.right(45)

for i in range(3):
	t1.forward(20)
	t2.forward(20)
	t1.left(15)
	t2.right(15)