520必备!这些Python表⽩代码祝你脱单成功⽬录
⼀、浪漫玫瑰花
⼆、浪漫玫瑰加爱⼼
三、⼼⼼相印
四、粉嫩爱⼼
五、丘⽐特⼀键穿⼼
六、发射爱⼼⼩⼈
七、浪漫动态樱花树
⼋、专属⼼形词云
九、⼥朋友画像字符画
⼀、浪漫玫瑰花
实现代码:
from turtle import *
import time
setup(1000,800,0,0)
speed(0)
penup()
seth(90)
fd(340)
seth(0)
pendown()
speed(5)
begin_fill()
fillcolor('red')
circle(50,30)
for i in range(10):
fd(1)
left(10)
circle(40,40)
for i in range(6):
fd(1)
left(3)
for i in range(20):    fd(0.5)
left(5)
circle(80,45)
for i in range(10):    fd(2)
left(1)
circle(80,25)
for i in range(20):    fd(1)
left(4)
circle(50,50) time.sleep(0.1) circle(120,55) speed(0)
seth(-90)
fd(70)
right(150)
fd(20)
left(140)
circle(140,90) left(30)
circle(160,100) left(130)
fd(25)
penup()
right(150) circle(40,80) pendown()
left(115)
fd(60)
penup()
left(180)
fd(60) pendown()
end_fill()
right(120) circle(-50,50) circle(-20,90) speed(1)
fd(75)
speed(0)
circle(90,110) penup()
left(162)
fd(185)
left(170) pendown() circle(200,10) circle(100,40) circle(-52,115) left(20)
circle(100,20) circle(300,20)
fd(250)
penup()
speed(0)
left(180)
fd(250)
circle(-300,7)
right(80)
circle(200,5)
pendown()
left(60)
begin_fill()
fillcolor('green')
circle(-80,100)
right(90)
fd(10)
left(20)
circle(-63,127)
end_fill()
penup()
left(50)
fd(20)
left(180)
pendown()
circle(200,25)
penup()
right(150)
fd(180)
right(40)
pendown()
begin_fill()
fillcolor('green')
circle(-100,80)
right(150)
fd(10)
left(60)
circle(-80,98)
end_fill()
penup()
left(60)
fd(13)
left(180)
pendown()
speed(1)
circle(-200,23)
exitonclick()
什么?只有玫瑰花太单调?那再给你来⼏个爱⼼够不够?⼆、浪漫玫瑰加爱⼼
实现代码:
import turtle
import time
import random
# 爱⼼函数
def yellowheart(x, y, liftx):
turtle.pensize(3)
turtle.speed(10)
turtle.up()
<(x, y)
turtle.down()
turtle.begin_fill()
turtle.left(liftx)
turtle.fd(80)
turtle.circle(-40, 180)
turtle.left(90)
turtle.circle(-40, 180)
turtle.left(0)
turtle.fd(80)
def rose():
turtle.speed(0)  # 画笔移动的速度
#acer(False)
# 设置初始位置
turtle.penup()  # 提起画笔
turtle.left(90)  # 逆时针转动画笔90度
turtle.fd(200)
turtle.pendown()  # 放下画笔,移动画笔即开始绘制    turtle.right(90)
# 设置画笔的⼤⼩
turtle.pensize(2)
# 花蕊
turtle.fillcolor("red")  # 填充颜⾊
turtle.begin_fill()  # 开始填充
turtle.circle(10, 180)
turtle.circle(25, 110)
turtle.left(50)
turtle.circle(60, 45)
turtle.circle(20, 170)
turtle.right(24)
turtle.left(10)
turtle.circle(30, 110)
turtle.fd(20)
turtle.left(40)
turtle.circle(90, 70)
turtle.circle(30, 150)
turtle.right(30)
turtle.fd(15)
turtle.circle(80, 90)
turtle.left(15)
turtle.fd(45)
turtle.right(165)
turtle.fd(20)
turtle.left(155)
turtle.circle(150, 80)
turtle.left(50)
turtle.circle(150, 90)
# 右侧花瓣
turtle.left(150)
turtle.circle(-90, 70)
turtle.left(20)
turtle.circle(75, 105)
turtle.setheading(60)
turtle.circle(80, 98)
turtle.circle(-90, 40)
# 左侧花瓣
turtle.left(180)
turtle.circle(90, 40)
turtle.circle(-80, 98)
表白代码手机turtle.setheading(-83)
# 左侧叶⼦
turtle.fd(30)
turtle.left(90)
turtle.fd(25)
turtle.left(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(-80, 90)
turtle.right(90)
turtle.circle(-80, 90)
turtle.right(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)
# 右侧叶⼦
turtle.right(90)
turtle.right(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(80, 90)
turtle.left(90)
turtle.circle(80, 90)
turtle.left(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(60)
turtle.right(90)
turtle.circle(200, 50)  # 画⼀个圆 200 是半径,50 是弧度    time.sleep(1)
# acer(False)
#turtle.pensize(3)
#turtle.speed(0)

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。