python学习第十天

#五彩星星
import turtle
def drawstar(x,y,c):
    turtle.color(c)
    turtle.up()
    turtle.goto(x,y)
    turtle.down()
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(100)
        turtle.right(144)
    turtle.end_fill()

turtle.bgcolor('black')
drawstar(-100,100,"yellow")
drawstar(100,100,"green")
drawstar(0,0,"orange")
drawstar(-100,-100,"red")
drawstar(100,-100,"purple")
turtle.done()
#五星红旗
import turtle
turtle.setup(600,400,0,0)
turtle.bgcolor('red')
turtle.fillcolor("yellow")
turtle.color("yellow")
turtle.speed(10)
def mygoto(x,y):
    turtle.up()
    turtle.goto(x,y)
def draw(z):
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(z)
        turtle.right(144)
    turtle.end_fill()

mygoto(-280,100)            #位置
turtle.down()               #落笔
draw(150)                   #绘制

mygoto(-100,180)
turtle.setheading(305)      #朝向
turtle.down()
draw(50)

mygoto(-80,100)
turtle.setheading(30)
turtle.down()
draw(50)

mygoto(-70,50)
turtle.setheading(5)
turtle.down()
draw(50)

mygoto(-90,20)
turtle.setheading(300)
turtle.down()
draw(50)

turtle.hideturtle()
turtle.done()
#888
import turtle
turtle.setup(500,500,200,200)
turtle.pensize(2)
turtle.pencolor('red')
turtle.right(90)
turtle.penup()          #笔尖朝上
turtle.fd(-20)          #后退20
turtle.pendown()        #笔尖朝下
turtle.seth(0)          #前进方向归零
turtle.circle(40)
turtle.circle(60)
turtle.circle(-60)
turtle.color('green')
turtle.circle(-40)
turtle.circle(80)
turtle.circle(-80)
turtle.done()

#radius半径
#extent弧度
#steps边数
#彩色图形
import turtle
turtle.bgcolor('black')
t=turtle.Turtle()       #绘图模块
colors=['red','yellow','blue','green']
for x in range(100):
    t.pencolor(colors[x%4])
    t.circle(x)
    t.left(90)
#条状物
import  turtle
turtle.setup(650,350,300,300)
turtle.penup()
turtle.fd(-250)             #forward
turtle.pendown()
turtle.pensize(55)
turtle.pencolor('brown')
turtle.seth(-40)            #改变进行角度
for i in range(4):
    turtle.circle(40,80)
    turtle.circle(-40,80)
turtle.circle(40,80/2)
turtle.fd(40)
turtle.circle(16,180)       #调头
turtle.fd(40*2/3)
turtle.done()

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值