zoukankan      html  css  js  c++  java
  • python基础(红旗)

    >>> import turtle
    >>> def square(start_x,start_y,rec_x,rec_y):
    turtle.goto(start_x,start_y)
    turtle.color('red')
    turtle.fillcolor('red')
    turtle.begin_fill()
    for i in range(2):
    turtle.forward(rec_x)
    turtle.left(90)
    turtle.forward(rec_y)
    turtle.left(90)
    turtle.end_fill()


    >>> def star(center_x,center_y,radius):
    turtle.setpos(center_x,center_y)
    pt1=turtle.pos()
    turtle.circle(-radius,72)
    pt2=turtle.pos()
    turtle.circle(-radius,72)
    pt3=turtle.pos()
    turtle.circle(-radius,72)
    pt4=turtle.pos()
    turtle.circle(-radius,72)
    pt5=turtle.pos()
    turtle.color('yellow','yellow')
    turtle.begin_fill()
    turtle.goto(pt3)
    turtle.goto(pt1)
    turtle.goto(pt4)
    turtle.goto(pt2)
    turtle.goto(pt5)
    turtle.end_fill()


    >>> turtle.speed(1)
    >>> turtle.speed(10)
    >>> turtle.penup()
    >>> star_x=-320
    >>> star_y=-260
    >>> len_x=660
    >>> len_y=440
    >>> square(star_x,star_y,len_x,len_y)
    >>> pice=660/30
    >>> big_center_x=star_x+5*pice
    >>> big_center_y=star_y+len_y-pice*5
    >>> turtle.goto(big_center_x,big_center_y)
    >>> turtle.left(90)
    >>> turtle.forward(pice*3)
    >>> turtle.right(90)
    >>> star(turtle.xcor(),turtle.ycor(),pice*3)
    >>> turtle.goto(star_x+10*pice,star_y+len_y-pice*2)
    >>> turtle.left(turtle.towards(big_center_x,big_center_y)-turtle.heading())
    >>> turtle.forward(pice)
    >>> turtle.right(90)
    >>> star(turtle.xcor(),turtle.ycor(),pice)
    >>> turtle.goto(star_x+12*pice,star_y+len_y-pice*4)
    >>> turtle.left(turtle.towards(big_center_x,big_center_y)-turtle.heading())
    >>> turtle.forward(pice)
    >>> turtle.right(90)
    >>> star(turtle.xcor(),turtle.ycor(),pice)
    >>> turtle.goto(star_x+12*pice,star_y+len_y-pice*7)
    >>> turtle.left(turtle.towards(big_center_x,big_center_y)-turtle.heading())
    >>> turtle.right(90)
    >>> star(turtle.xcor(),turtle.ycor(),pice)
    >>> turtle.goto(star_x+10*pice,star_y+len_y-pice*9)
    >>> turtle.left(turtle.towards(big_center_x,big_center_y)-turtle.heading())
    >>> turtle.right(90)
    >>> star(turtle.xcor(),turtle.ycor(),pice)
    >>>

  • 相关阅读:
    springBoot jpa 分页
    springBoot jpa 表单关联查询
    springBoot 登录拦截器
    SpringBoot 封装返回类以及session 添加获取
    SpringBoot 数据库操作 增删改查
    IDEA SpringBoot +thymeleaf配置
    IDEA Spring Boot 项目创建
    php判断手机段登录,以及phpcms手机PC双模板调用
    简单爬虫,查博客浏览量
    [51nod1357]密码锁 暨 GDOI2018d1t2
  • 原文地址:https://www.cnblogs.com/shadows24/p/8575889.html
Copyright © 2011-2022 走看看