Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3593397
  • 博文数量: 365
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2522
  • 用 户 组: 普通用户
  • 注册时间: 2019-10-28 13:40
文章分类

全部博文(365)

文章存档

2023年(8)

2022年(130)

2021年(155)

2020年(50)

2019年(22)

我的朋友

分类: Python/Ruby

2022-11-16 17:15:40

from turtle import *

from time import sleep

def go_to(x, y):

   up()

   goto(x, y)

   down()

def big_Circle(size):  #函数用于绘制心的大圆

   speed(9)

   for i in range(150):

       forward(size)

       right(0.3)

def small_Circle(size):  #函数用于绘制心的小圆

   speed(1)

   for i in range(210):

       forward(size)

       right(0.786)

def line(size):

   speed(1)

   forward(51*size)

def heart( x, y, size):

   go_to(x, y)

   left(150)

   begin_fill()

   line(size)

   big_Circle(size)

   small_Circle(size)

   left(120)

   small_Circle(size)

   big_Circle(size)

   line(size)

   end_fill()

def arrow():

   pensize(10)

   setheading(0)

   go_to(-400, 0)

   left(15)

   forward(150)

   go_to(339, 178)

   forward(150)

def arrowHead():

   pensize(1)

   speed(1)

   color('red', 'red')

   begin_fill()

   left(120)

   forward(20)

   right(150)

   forward(35)

   right(120)

   forward(35)

   right(150)

   forward(20)

   end_fill()

def main():

   pensize(2)

   color('red', 'pink')

   #getscreen().tracer(30, 0) #取消注释后,快速显示图案

   heart(200, 0, 1)          #画出{BANNED}中国第一颗心,外汇跟单gendan5.com前面两个参数控制心的位置,函数{BANNED}最佳后一个参数可控制心的大小

   setheading(0)             #使画笔的方向朝向x轴正方向

   heart(-80, -100, 1.5)     #画出第二颗心

   arrow()                   #画出穿过两颗心的直线

   arrowHead()               #画出箭的箭头

   go_to(400, -300)

   write("authorpy.cn", move=True, align="left", font=("宋体", 30, "normal"))

   done()

main()

阅读(424) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~