最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python+turtle繪制七夕表白玫瑰花

 更新時間:2022年08月01日 08:58:57   作者:阿黎逸陽  
七夕節(jié),又稱“七巧節(jié)”“女兒節(jié)”“乞巧節(jié)”等,是中國民間的傳統(tǒng)節(jié)日。一年一度的七夕又快到了,用Python畫一朵玫瑰花送給你的那個TA吧

中國情人節(jié)

七夕節(jié),又稱“七巧節(jié)”“女兒節(jié)”“乞巧節(jié)”等,是中國民間的傳統(tǒng)節(jié)日。這個節(jié)日被賦予了“牛郎織女”的美麗愛情傳說,被認為是中國最具浪漫色彩的傳統(tǒng)節(jié)日,在當(dāng)代更是產(chǎn)生了“中國情人節(jié)”的文化含義。

一年一度的七夕又快到了,用Python畫一朵玫瑰花送給你的那個TA吧。

更多表白代碼可以翻看表白合集中的文章,可以邊聽音樂邊看Python代碼圖。

一、繪制結(jié)果

1. 玫瑰花1

2. 玫瑰花2

二、畫玫瑰花代碼

1. 用turtle庫畫一朵玫瑰花版本1

# -*- coding: UTF-8 -*-
'''
代碼用途 :畫玫瑰花
作者     :阿黎逸陽
博客     :  https://blog.csdn.net/qq_32532663/article/details/106176609
'''

#繪制玫瑰花并添加文字
import turtle 
# 設(shè)置畫布大小
# turtle.screensize(canvwidth=None, canvheight=None, bg=None)
turtle.setup(width=0.6, height=0.6)
# 設(shè)置初始位置
turtle.penup()
turtle.left(90)
turtle.fd(200)
turtle.pendown()
turtle.right(90)
 
# 輸出文字
printer = turtle.Turtle()
printer.hideturtle()
printer.penup()
printer.back(200)
printer.write("贈給親愛的 XX\n\n", align="right", font=("楷體", 16, "bold"))
printer.write("from XXX", align="center", font=("楷體", 12, "normal"))
 
# 花蕊
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.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.end_fill()
 
# 花瓣1
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)
 
# 花瓣2
turtle.left(180)
turtle.circle(90, 40)
turtle.circle(-80, 98)
turtle.setheading(-83)
 
# 葉子1
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.end_fill()
turtle.right(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)
 
# 葉子2
turtle.right(90)
turtle.right(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(80, 90)
turtle.left(90)
turtle.circle(80, 90)
turtle.end_fill()
turtle.left(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(60)
turtle.right(90)
turtle.circle(200, 60)
 
turtle.done()

效果圖

2. 用turtle庫畫一朵玫瑰花版本2

# -*- coding: UTF-8 -*-
'''
代碼用途 :畫玫瑰花
作者     :阿黎逸陽
博客     :  https://blog.csdn.net/qq_32532663/article/details/106176609
'''
import os
import time
import pygame
import turtle as t 

#播放音樂
print('播放音樂')
pygame.mixer.init()
pygame.mixer.music.load(r"F:\公眾號\62.玫瑰花\Eran - 春の思い出.mp3") 
pygame.mixer.music.set_volume(0.5) 
pygame.mixer.music.play(1, 10)

t.title('阿黎逸陽的代碼公眾號')
t.speed(3)
t.setup(startx=0, starty = 0, width=800, height = 600)
#畫愛心
def red_heart():
    t.penup()
    t.goto(0, 200)
    t.pendown()
    t.pensize(2)
    t.color('black', 'red')   
    t.begin_fill()
    t.setheading(110)
    t.circle(30, 150)
    t.left(15)
    t.circle(50, 70)
    t.circle(-50, 30)
    t.left(100)
    t.circle(-50, 30)
    t.right(10)
    t.circle(50, 70)
    t.left(5)
    t.circle(29, 175)
    t.end_fill()
def top_arc():
    #畫花上面的部分
    t.penup()
    t.goto(18, 224)
    t.pendown()
    t.begin_fill()
    t.setheading(125)
    t.pensize(2)
    t.color('black', 'red')
    t.circle(25, 125)
    t.color('red')
    t.circle(25, 360-125)
    t.end_fill()
def under_arc():
    #畫下弧線
    t.penup()
    t.goto(-58, 190)
    t.pendown()
    t.begin_fill()
    t.color('black', 'red')
    t.setheading(290)
    t.circle(-120, 50)
    t.circle(60, 120)
    t.setheading(-10)
    t.circle(60, 120)
    t.left(4)
    t.circle(-120, 50)
    t.end_fill()
def stamen():
    #畫花蕊
    t.penup()
    t.goto(0, 185)
    t.pendown()
    t.setheading(90)
    t.circle(5, 270)
    t.right(5)
    t.circle(100, 8)
    #t.right(10)
    t.circle(10, 180)
    t.circle(100, 8)
    t.right(10)
    t.circle(15, 160)
    t.circle(80, 5)
    t.right(34)
    t.circle(-30, 80)
    #畫花身
    t.right(10)
    t.circle(100, 82)
    #畫豎線
    t.penup()
    t.goto(-10, 183)
    t.pendown()
    t.setheading(-90)
    t.forward(15)
    t.penup()
    t.goto(-21, 179)
    t.pendown()
    t.setheading(-90)
    t.forward(25)
    t.penup()
    t.goto(18, 185)
    t.pendown()
    t.setheading(-90)
    t.forward(29)
print('畫心')
red_heart()
print('畫頂部弧線')
top_arc()
print('畫下弧線')
under_arc()
print('畫心')
red_heart()
print('畫花蕊')
stamen() 
# 寫文字
t.hideturtle()
t.penup()
t.goto(-200, -200)
t.pendown()
t.write("贈給親愛的 XX\n\n", align="right", font=("楷體", 16, "bold"))
t.penup()
t.goto(-200, -200)
t.pendown()
t.write("from XXX", align="right", font=("楷體", 12, "normal"))

效果視頻

到此這篇關(guān)于Python+turtle繪制七夕表白玫瑰花的文章就介紹到這了,更多相關(guān)Python turtle玫瑰花內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Python加密與解密模塊hashlib與hmac

    Python加密與解密模塊hashlib與hmac

    這篇文章介紹了Python中的加密與解密模塊hashlib與hmac,文中通過示例代碼介紹的非常詳細。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-06-06
  • Python開發(fā)虛擬環(huán)境使用virtualenvwrapper的搭建步驟教程圖解

    Python開發(fā)虛擬環(huán)境使用virtualenvwrapper的搭建步驟教程圖解

    virtualenvwrapper是用來管理virtualenv的擴展包,用著很方便。這篇文章主要介紹了Python開發(fā)虛擬環(huán)境使用virtualenvwrapper的搭建步驟 ,需要的朋友可以參考下
    2018-09-09
  • python快排算法詳解

    python快排算法詳解

    在本篇內(nèi)容里小編給大家整理了關(guān)于python快排算法的相關(guān)知識點內(nèi)基礎(chǔ)內(nèi)容,需要的朋友們學(xué)習(xí)下。
    2019-03-03
  • python?PyQt5中QButtonGroup的詳細用法解析與應(yīng)用實戰(zhàn)記錄

    python?PyQt5中QButtonGroup的詳細用法解析與應(yīng)用實戰(zhàn)記錄

    在PyQt5中,QButtonGroup是一個用于管理按鈕互斥性和信號槽連接的類,它可以將多個按鈕劃分為一個組,管理按鈕的選中狀態(tài)和ID,本文詳細介紹了QButtonGroup的創(chuàng)建、使用方法和實際應(yīng)用案例,適合需要在PyQt5項目中高效管理按鈕組的開發(fā)者
    2024-10-10
  • 基于Python實現(xiàn)二維圖像雙線性插值

    基于Python實現(xiàn)二維圖像雙線性插值

    雙線性插值,又稱為雙線性內(nèi)插。在數(shù)學(xué)上,雙線性插值是有兩個變量的插值函數(shù)的線性插值擴展,其核心思想是在兩個方向分別進行一次線性插值。本文將用Python實現(xiàn)二維圖像雙線性插值,感興趣的可以了解下
    2022-06-06
  • 解決python圖像處理圖像賦值后變?yōu)榘咨膯栴}

    解決python圖像處理圖像賦值后變?yōu)榘咨膯栴}

    這篇文章主要介紹了解決python圖像處理圖像賦值后變?yōu)榘咨膯栴},具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-06-06
  • Python利用緩存流實現(xiàn)壓縮PDF文件

    Python利用緩存流實現(xiàn)壓縮PDF文件

    在Python中,有許多庫可以用來壓縮PDF文件,其中最常用的是PyPDF2和PDFMiner,本文將為大家介紹一個新的方法,即使用緩存流壓縮PDF文件,感興趣的可以了解下
    2023-08-08
  • Python基礎(chǔ)語法(Python基礎(chǔ)知識點)

    Python基礎(chǔ)語法(Python基礎(chǔ)知識點)

    這篇文章主要介紹了Python基礎(chǔ)語法(Python基礎(chǔ)知識點),需要的朋友可以參考下
    2016-02-02
  • django 通過url實現(xiàn)簡單的權(quán)限控制的例子

    django 通過url實現(xiàn)簡單的權(quán)限控制的例子

    今天小編就為大家分享一篇django 通過url實現(xiàn)簡單的權(quán)限控制的例子,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-08-08
  • Python條件語句的使用

    Python條件語句的使用

    python 語句是按固定順序執(zhí)行的,先執(zhí)行前面的語句,再執(zhí)行后面的語句,這篇文章主要介紹了Python條件語句的用法,需要的朋友可以參考下
    2022-08-08

最新評論

青阳县| 寿阳县| 仪陇县| 新昌县| 金湖县| 石狮市| 扬中市| 吴桥县| 察隅县| 长垣县| 浦县| 南漳县| 茌平县| 通化市| 滦南县| 四子王旗| 新乡市| 邯郸县| 瓦房店市| 胶南市| 黔东| 吉木萨尔县| 谢通门县| 饶阳县| 宁晋县| 重庆市| 定远县| 镇安县| 龙江县| 丹江口市| 交城县| 邵阳市| 吉木乃县| 威海市| 富裕县| 朝阳县| 合阳县| 涞源县| 肇源县| 富裕县| 中西区|