ʕ·͡ˑ·ཻʔ Daisy 🐾 ◟̆◞̆♥︎
Zou-Wang
点击头像关注

三っ•̀.̫•́)っ 我去宇宙了 ⁽⁽ଘ( ˊᵕˋ )ଓ⁾⁾

小白艰难的Python图像的绘制

1、贪吃蛇

代码:

import turtle
turtle.setup(650,350)
turtle.penup()
turtle.fd(-250)
turtle.pendown()
turtle.pensize(20)
turtle.pencolor("black")
turtle.seth(-40)

for i in range(4):
    turtle.circle(40,80)
    turtle.circle(-40,80)
    
turtle.circle(40,80/2)
turtle.fd(60)
turtle.pencolor("blue")
turtle.circle(30,180)
turtle.fd(40*2/3)
turtle.done()

效果:

2、绘制八角形

代码:

import turtle as t
t.setup(600,600)
t.pencolor("black")
t.pensize(5)
for i in range(8):
    t.fd(200)
    t.left(135)
t.done()

效果:

3、六边形的绘制

代码:

import turtle as t
t.setup(600,600)
t.pencolor("black")
t.pensize(5)
for i in range(8):
    t.right(45)
    t.fd(80)
t.done()

效果:

4、四色花的绘制

代码:

import turtle as t
t.setup(700,700)
t.pensize(5)
t.pencolor("orange")
t.fillcolor('orange')
t.begin_fill()
t.left(135)
t.fd(100)
t.right(135)
t.fd(75)
t.left(-90)
t.fd(75)
t.end_fill()

t.pensize(5)
t.pencolor("blue")
t.fillcolor('blue')
t.begin_fill()
t.left(135)
t.fd(100)
t.right(135)
t.fd(75)
t.left(-90)
t.fd(75)
t.end_fill()

t.pensize(5)
t.pencolor("purple")
t.fillcolor('purple')
t.begin_fill()
t.left(135)
t.fd(100)
t.right(135)
t.fd(75)
t.left(-90)
t.fd(75)
t.end_fill()

t.pensize(5)
t.pencolor("red")
t.fillcolor('red')
t.begin_fill()
t.left(135)
t.fd(100)
t.right(135)
t.fd(75)
t.left(-90)
t.fd(75)
t.end_fill()

t.pensize(8)
t.pencolor("green")
t.penup()
t.fd(-3)
t.pendown()
t.right(90)
t.fd(200)

t.done()

效果:

posted @ 2019-07-15 19:59  没忘  阅读(387)  评论(0编辑  收藏  举报