您现在的位置是:网站首页> 编程资料编程资料
三个520专属Python表白代码分享_python_
2023-05-26
398人已围观
简介 三个520专属Python表白代码分享_python_
快到 520 了,分享几段 520 专属 Python 代码,不多说了,下面直接上货。
No.1
效果:

主要代码:
import turtle turtle.speed(0) turtle.delay(10) turtle.penup() turtle.left(90) turtle.fd(200) turtle.pendown() turtle.right(90) 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.fd(30) turtle.left(10) # 花瓣 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.color('red') turtle.pu() turtle.goto(-210,80) turtle.pd() turtle.write('520 Happy', move=False, align='center',font=("Times", 18, "bold")) turtle.pu() turtle.goto(210,80) turtle.pd() turtle.write('I LOVE YOU', move=False, align='center',font=("Times", 18, "bold")) turtle.pu() turtle.pu() turtle.hideturtle() turtle.done() No.2
效果:

主要代码:
import turtle as t t.speed(0) t.delay(10) t.color('red','pink') t.begin_fill() t.width(5) t.left(135) t.fd(100) t.right(180) t.circle(50,-180) t.left(90) t.circle(50,-180) t.right(180) t.fd(100) t.pu() t.goto(50,-30) # 箭头 t.begin_fill() t.left(-30) t.fd(-15) t.right(-40) t.fd(-50) t.right(-165) t.fd(-50) t.end_fill() # 文字 t.color('red') t.pu() t.goto(-150,30) t.pd() t.write('I LOVE YOU', move=False, align='center', font=("Times", 18, "bold")) t.hideturtle() t.done() No.3
效果:

主要代码:
import turtle import random # 画爱心 def love(x, y): lv = turtle.Turtle() lv.hideturtle() lv.up() # 定位 lv.goto(x, y) # 画圆弧 def curvemove(): for i in range(20): lv.right(10) lv.forward(2) lv.color('red', 'pink') lv.speed(10000000) lv.pensize(1) lv.down() lv.begin_fill() lv.left(140) lv.forward(22) curvemove() lv.left(120) curvemove() lv.forward(22) # 画完复位 lv.left(140) lv.end_fill() myWin = turtle.Screen() myWin.setup(width=700, height=700) t = turtle.Turtle() t.speed(0) turtle.delay(0) t.hideturtle() t.left(90) t.up() t.backward(200) t.down() t.color("brown") t.pensize(32) t.forward(60) tree(100, t) myWin.exitonclick() 到此这篇关于三个520专属Python表白代码分享的文章就介绍到这了,更多相关Python表白代码内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
您可能感兴趣的文章:
相关内容
- Python中for循环可迭代对象迭代器及生成器源码学习_python_
- 如何利用python实现kmeans聚类_python_
- PyTorch使用GPU训练的两种方法实例_python_
- Python如何获取多线程返回结果_python_
- Python作用域与名字空间源码学习笔记_python_
- 基于Python实现在线二维码生成工具_python_
- 详解基于K-means的用户画像聚类模型_python_
- python利用多线程+队列技术爬取中介网互联网网站排行榜_python_
- 利用Pygame制作简单动画的示例详解_python_
- Python字节码与程序执行过程详解_python_
