反正也没什么人看,搞个圣诞树

2024-03-27 18:40

本文主要是介绍反正也没什么人看,搞个圣诞树,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

​今晚的平安夜,明天的圣诞节,祝大家平安夜开心,圣诞节快乐,祝明天考研的学子考神附体,Merry Christmas!

2021即将走进尾声,愿你喜欢的都拥有,失去的都释怀,祝你平安喜乐,心想事成

在这里插入图片描述

先来看看圣诞树效果吧

在这里插入图片描述

在这里插入图片描述

画苹果

goto(0, 150)
turtle.begin_fill()
turtle.color("red")
turtle.circle(radius=30)
turtle.end_fill()turtle.color("brown")
turtle.pu()
turtle.goto(-15, 190)
turtle.pd()
turtle.circle(36, 40)
turtle.pu()
turtle.seth(105)
turtle.goto(-1, 194)
turtle.pd()
turtle.circle(36, 50)
turtle.pd()
​turtle.begin_fill()
turtle.color("green")
turtle.circle(36, 50)
turtle.seth(-30)
turtle.circle(36, 55)
turtle.end_fill()
​
turtle.begin_fill()
turtle.color("green")
turtle.seth(0)
turtle.circle(36, 50)
turtle.seth(-180)
turtle.circle(36, 50)
turtle.end_fill()
penup()

在这里插入图片描述

画圣诞树

seth(-120)
for i in range(10):fd(12)right(2)
penup()
goto(0, 150)
seth(-60)
pendown()
for i in range(10):fd(12)left(2)
seth(-150)
penup()
fd(10)
pendown()
for i in range(5):fd(10)right(15)
seth(-150)
penup()
fd(8)
pendown()
for i in range(5):fd(10)right(15)
seth(-155)
penup()
fd(5)
pendown()
for i in range(5):fd(7)right(15)penup()
goto(-55, 34)
pendown()
seth(-120)
for i in range(10):fd(8)right(5)
​
penup()
goto(50, 35)
seth(-60)
pendown()
for i in range(10):fd(8)left(5)
seth(-120)
penup()
fd(10)
seth(-145)
pendown()
for i in range(5):fd(10)right(15)
penup()
fd(10)
seth(-145)
pendown()
for i in range(5):fd(12)right(15)
penup()
fd(8)
seth(-145)
pendown()
for i in range(5):fd(10)right(15)
penup()
seth(-155)
fd(8)
pendown()
for i in range(5):fd(11)right(15)penup()
goto(-100, -40)
seth(-120)
pendown()
for i in range(10):fd(6)right(3)
penup()
goto(80, -39)
seth(-50)
pendown()
for i in range(10):fd(6)left(3)
seth(-155)
penup()
fd(10)
pendown()
for i in range(5):fd(8)right(10)
penup()
fd(8)
seth(-145)
pendown()
for i in range(7):fd(8)right(10)
penup()
fd(8)
seth(-145)
pendown()
for i in range(7):fd(7)right(10)
penup()
fd(8)
seth(-145)
pendown()
for i in range(7):fd(7)right(10)
penup()
fd(8)
seth(-140)
pendown()
for i in range(7):fd(6)right(10)
​penup()
goto(-120, -95)
seth(-130)
pendown()
for i in range(7):fd(10)right(5)
penup()
goto(100, -95)
seth(-50)
pendown()
for i in range(7):fd(10)left(5)
penup()
seth(-120)
fd(10)
seth(-155)
pendown()
for i in range(6):fd(8)right(10)
penup()
seth(-160)
fd(10)
seth(-155)
pendown()
for i in range(6):fd(8)right(10)
penup()
seth(-160)
fd(10)
seth(-155)
pendown()
for i in range(6):fd(8)right(10)
penup()
seth(-160)
fd(10)
seth(-160)
pendown()
for i in range(6):fd(8)right(10)
penup()
seth(-160)
fd(10)
seth(-160)
pendown()
for i in range(6):fd(8)right(10)
penup()
seth(-160)
fd(10)
seth(-165)
pendown()
for i in range(5):fd(10)right(11)

画树干

pencolor("#8B4513")
penup()
goto(-70, -165)
seth(-85)
pendown()
for i in range(3):fd(5)left(3)
penup()
goto(70, -165)
seth(-95)
pendown()
for i in range(3):fd(5)right(3)
seth(-170)
penup()
fd(10)
pendown()
pendown()
for i in range(10):fd(12)right(2)

在这里插入图片描述

画蝴蝶结

def hdj(x, y):penup()pencolor("#f799e6")goto(x, y)seth(80)pendown()pensize(2)circle(5)seth(10)fd(15)seth(120)fd(20)seth(240)fd(20)seth(180)fd(20)seth(-60)fd(20)seth(50)fd(20)seth(-40)fd(30)seth(-130)fd(5)seth(135)fd(30)seth(-60)fd(30)seth(-150)fd(6)seth(110)fd(30)
​
​
def uit(x, y):penup()pencolor("#f799e6")goto(x, y)pendown()pensize(2)circle(5)seth(-10)fd(15)seth(90)fd(15)seth(200)fd(15)seth(160)fd(15)seth(-90)fd(15)seth(10)fd(15)seth(-60)fd(20)seth(-180)fd(5)seth(110)fd(20)seth(-90)fd(20)seth(-180)fd(6)seth(70)fd(15)hideturtle()seth(0)
uit(40, -150)
​
hdj(-80, -110)
yut(-67, -105, 120)
yut(-86, -113, 150)
​
hdj(40, -40)
yut(52, -35, 130)
yut(34, -45, 160)
seth(0)
uit(-20, -50)
yut(-4, -50, 100)
yut(-20, -50, 120)
​
hdj(-30, 30)
yut(-15, 35, 130)
yut(-40, 30, 180)
​
uit(30, 70)
yut(45, 70, 100)
yut(30, 70, 120)
​
​
def iou(x, y, z):penup()goto(x, y)pencolor("red")pendown()seth(z)for po in range(10):fd(4)left(18)seth(-20)
pensize(2)
penup()
goto(-30, -120)
pencolor("white")
pendown()
fillcolor("white")
begin_fill()
fd(30)
circle(4, 180)
fd(30)
circle(4, 180)
end_fill()
penup()
goto(-25, -115)
seth(75)
pendown()
fillcolor("red")
begin_fill()
for i in range(5):fd(6)right(20)
seth(-10)
for i in range(5):fd(8)right(15)
seth(145)
for i in range(5):fd(5)left(2)
seth(90)
for i in range(5):fd(1)left(2)
seth(-90)
for i in range(4):fd(4)right(6)
seth(161)
fd(30)
end_fill()
pensize(1)
pencolor("white")def koc(x, y, size):pensize(2)pencolor("yellow")penup()goto(x, y)pendown()begin_fill()fillcolor("yellow")for i in range(5):left(72)fd(size)right(144)fd(size)end_fill()


在这里插入图片描述

画星星

seth(-15)
koc(-120, -70, 10)
seth(10)
koc(100, -20, 10)
seth(-10)
koc(10, 40, 10)
seth(30)
koc(-80, 60, 10)
koc(100, -150, 10)
koc(-140, -150, 10)
koc(80, -100, 10)def koc(x, y, size):pensize(2)pencolor("yellow")penup()goto(x, y)pendown()begin_fill()fillcolor("yellow")for i in range(5):left(72)fd(size)right(144)fd(size)end_fill()
​
​seth(-15)
koc(-120, -70, 10)
seth(10)
koc(100, -20, 10)
seth(-10)
koc(10, 40, 10)
seth(30)
koc(-80, 60, 10)
koc(100, -150, 10)
koc(-140, -150, 10)
koc(80, -100, 10)

在这里插入图片描述

画动态雪花

screen.delay(0)  
t = Turtle(visible=False, shape='circle')
t.pencolor("white")
t.fillcolor("white")
t.penup()
t.setheading(-90)
t.goto(r.randint(-width / 2, width / 2), height / 2)
stars = []
for i in range(200):star = t.clone()s = r.random() / 3star.shapesize(s, s)star.speed(int(s * 10))star.setx(r.randint(-width / 2, width / 2))star.sety(height / 2 + r.randint(1, height))star.showturtle()stars.append(star)
while True:for star in stars:star.sety(star.ycor() - 8 * star.speed())if star.ycor() < -height / 2:star.hideturtle()star.setx(r.randint(-width / 2, width / 2))star.sety(height / 2 + r.randint(1, height))star.showturtle()
​
hideturtle()
done()

感性与理性的交织,迷茫与坚定的纵横,业余与专业的并行,追梦我伴你前行

源码可到"一团追梦喵"发送"圣诞树"即可,发送"玫瑰花",也会有惊喜呦!

悄悄告诉你们,小编的圣诞祝福是看到这段话的宝贝:暴富,恋爱,平安,幸福。

这篇关于反正也没什么人看,搞个圣诞树的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/853033

相关文章

【日记】第一次养植物,没什么经验……(781 字)

正文   前两天梦见灵送的几盆植物全都死掉了。梦里好伤心。醒来与她说这件事,她宽慰我说,梦都是反着的,肯定能活得很好的。于是忽然记起昨天给植物换水时,文竹的根居然从花盆底部伸吊了出来,以前都没有这种情况来着,看来确实长得很好。不过我曾记得我许久之前将文竹所有枯萎的针叶都剪掉了,近些天看,又有很大面积的枯黄针叶,与此同时,新的分支却又长得很茂盛葳蕤,节节窜高。感觉这种情况好奇怪,难不成植物在长成之

端午搞个零花钱,轻松赚取创业的第一桶金!2024最受欢迎的创业项目,2024新的创业机会

好好的端午节, 净给我添堵! 本来我打算在端午节愉快的玩耍, 结果一大早起床却看到舍友在给一堆设备充电, 然后装的整整齐齐, 满满一书包。 我好奇他小子这是要干嘛? 不会是打算今天回去给亲朋好友准备的礼物吧? 结果这小子嘿嘿一笑: 今天不回家,也不出去玩耍, 出去创业去! 我倒是奇怪了, 端午大家都在旅游, 市里连个人毛都没有, 你创业东西卖给谁? 然后舍友就

html--圣诞树

将以下代码保存到txt文件中,并改名为xx.html <html><head><title>圣诞树</title><meta charset="utf-8" ><style>html, body { width: 100%; height: 100%; margin: 0; padding: 0; border: 0; }div { margin: 0; padding: 0;

VOJ 圣诞树 题解 最短路径 dijkstra算法

圣诞树 题目描述 圣诞节快到了,小明准备做一棵大圣诞树。 这棵树被表示成一组被编号的结点和一些边的集合,树的结点从 1 到 n 编号,树的根永远是 1。每个结点都有一个自身特有的数值,称为它的权重,各个结点的权重可能不同。对于一棵做完的树来说,每条边都有一个价值 v e ve ve,若设这条边 e 连接结点 i 和结点 j,且 i 为 j 的父结点(根是最老的祖先),则该边的价值 v e

给自己Linux搞个『回收站』,防止文件误删除

linux没有像windows里一样的回收站,工作时候删除文件容易不小心删错,造成麻烦的后果。所以给自己整了个回收站: 文件删除,新建~/opts/move_to_trash.sh,然后在里面新增,将${your_name}改成你的用户名。同时在~/.bashrc中alias rm命令到这个脚本,即是alias rm='sh ~/opts/move_to_trash.sh',别忘了source

Python没什么?深度解析Python的无限可能与挑战

Python没什么?深度解析Python的无限可能与挑战 Python,这门看似简单的编程语言,实则蕴含着无尽的奥秘与潜力。然而,当我们深入探索时,却不禁会产生一些疑问:Python真的没什么吗?本文将从四个方面、五个方面、六个方面和七个方面,带你一起揭开Python的神秘面纱,探讨其背后的深度与广度。 四个方面:Python的简洁与强大 Python以其简洁易懂的语法而著称,但这并不意味着

android 属性动画应用,不知道这个效果好看,反正挺好玩的!

前两天为了看漫画,下载了一个动漫APP,打开一看,滑动的时候竟然下面的TAB跟上面的TITEL都隐藏掉了,变成全屏了,感觉好牛逼的样子哦,当初我以为是隐藏跟现实的属性那,后来一仔细看,不是,那么只有动画来实现了,看来还得用属性动画来实现:属性动画嘛就是改变了对象的属性了。不知道这个效果好不好,应该适合一些全屏阅读类的app. 先看看它的效果: 在看看咱们的效果: 好了 ,代码很少

牛客网刷题 | BC114 圣诞树 (不理解)

目前主要分为三个专栏,后续还会添加:         专栏如下:                 C语言刷题解析       C语言系列文章       我的成长经历 感谢阅读! 初来乍到,如有错误请指出,感谢! 这道题没搞懂 也没找到视频 水了篇文章 大家有思路可以放到评论区 或者有视频也行 放个链接给我 我去学一学 #define _CRT_SECURE_NO_W

3d圣诞树

演示地址 :由于模型有点大,加载出来需要两分钟左右。。 代码地址 思路 一、引用基于three.js封装的开源框架https://github.com/kovacsv/Online3DViewer/wiki/Use-the-Viewer-on-Your-Website 二、加载圣诞树模型 <div class="online_3d_viewer"class="online_3d_view

python绘制圣诞树 如何用python绘制一个圣诞树

欢迎关注我👆,收藏下次不迷路┗|`O′|┛ 嗷~~ 目录 一.前言 二.代码 三.使用 四.总结 一.前言 圣诞树,是指用灯烛和装饰品把枞树或洋松装点起来的常青树。作为是圣诞节重要的组成元素之一,近代圣诞树起源于德国,后来逐步在世界范围内流行起来ÿ