520即将来袭~普通人表白,发微信买花

程序员表白,用代码给女神画玫瑰,画爱心无线弹窗表白,网页无线弹窗表白

第一种:心连心

from turtle import* color ("black","red") pensize(5) begin_fill() penup()
goto(50,50) pendown() right(45) goto(100,0) left(90) fd(120) circle(50,225)
penup() goto(0,0) pendown() left(135) fd(120) circle(50,225) seth(90)
circle(50,225) fd(121) end_fill() left(56) penup() goto(-210,40) pendown()
goto(0,80) penup() goto(160,110) pendown() goto(320,140) done()

 

第二种:玫瑰花

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) circle(80,40) 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) speed(1) 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()
第三种:画彩虹

所有美好的事情都是彩虹

from turtle import * def HSB2RGB(hues): hues = hues * 3.59 #100转成359范围
rgb=[0.0,0.0,0.0] i = int(hues/60)%6 f = hues/60 -i if i == 0: rgb[0] = 1;
rgb[1] = f; rgb[2] = 0 elif i == 1: rgb[0] = 1-f; rgb[1] = 1; rgb[2] = 0 elif i
== 2: rgb[0] = 0; rgb[1] = 1; rgb[2] = f elif i == 3: rgb[0] = 0; rgb[1] = 1-f;
rgb[2] = 1 elif i == 4: rgb[0] = f; rgb[1] = 0; rgb[2] = 1 elif i == 5: rgb[0]
= 1; rgb[1] = 0; rgb[2] = 1-f return rgb def rainbow(): hues = 0.0 color(1,0,0)
#绘制彩虹 hideturtle() speed(100) pensize(3) penup() goto(-400,-300) pendown()
right(110) for i in range (100): circle(1000) right(0.13) hues = hues + 1 rgb =
HSB2RGB(hues) color(rgb[0],rgb[1],rgb[2]) penup() def main(): setup(800, 600,
0, 0) bgcolor((0.8, 0.8, 1.0)) tracer(False) rainbow() #输出文字 tracer(False)
goto(100,-100) pendown() color("red") tracer(True) mainloop() if __name__ ==
"__main__": main()
第四种:爱心—送给所有的小仙女

源码:
# -*- coding:utf-8 -*- import turtle import time # 画爱心的顶部 def LittleHeart():
for i in range(200): turtle.right(1) turtle.forward(2) # 输入表白的语句,默认I Love you
love = input('请输入表白语句,默认为输入为"I Love you": ') # 输入署名或者赠谁,没有不执行 me =
input('请输入您心上人的姓名或者昵称: ') if love == '': love = 'I Love you' # 窗口大小
turtle.setup(width=800, height=500) # 颜色 turtle.color('red', 'pink') # 笔粗细
turtle.pensize(5) # 速度 turtle.speed(1) # 提笔 turtle.up() # 隐藏笔
turtle.hideturtle() # 去到的坐标,窗口中心为0,0 turtle.goto(0, -180) turtle.showturtle() #
画上线 turtle.down() turtle.speed(1) turtle.begin_fill() turtle.left(140)
turtle.forward(224) # 调用画爱心左边的顶部 LittleHeart() # 调用画爱右边的顶部 turtle.left(120)
LittleHeart() # 画下线 turtle.forward(224) turtle.end_fill() turtle.pensize(5)
turtle.up() turtle.hideturtle() # 在心中写字 一次 turtle.goto(0, 0)
turtle.showturtle() turtle.color('#CD5C5C', 'pink') # 在心中写字
font可以设置字体自己电脑有的都可以设 align开始写字的位置 turtle.write(love, font=('gungsuh', 30,),
align="center") turtle.up() turtle.hideturtle() time.sleep(2) # 在心中写字 二次
turtle.goto(0, 0) turtle.showturtle() turtle.color('red', 'pink')
turtle.write(love, font=('gungsuh', 30,), align="center") turtle.up()
turtle.hideturtle() # 写署名 if me != '': turtle.color('black', 'pink')
time.sleep(2) turtle.goto(180, -180) turtle.showturtle() turtle.write(me,
font=(20,), align="center", move=True) # 点击窗口关闭 window = turtle.Screen()
window.exitonclick()

、、

技术
下载桌面版
GitHub
Gitee
SourceForge
百度网盘(提取码:draw)
云服务器优惠
华为云优惠券
腾讯云优惠券
阿里云优惠券
Vultr优惠券
站点信息
问题反馈
邮箱:[email protected]
吐槽一下
QQ群:766591547
关注微信