用Python画一朵小红花

用Python画一朵小红花,第1张

用Python画一朵小红花
# -*- coding: utf-8 -*-
"""
Created on Thu Nov  4 19:11:14 2021

@author: SHI Baoming
"""
from turtle import *
# 定义画花瓣的函数
def drawLeaf():
    begin_fill()
    for i in range(2):
        for i in range(15):
            lt(6)
            fd(5)
            
        lt(90)
    end_fill()
    
#主程序开始
speed(0)
pu()
goto(0,-200)

# 画花柄
pd()    
color('black','green')
for i in range(2):        
    lt(90)
    fd(100)
    drawLeaf()
    rt(90)
    drawLeaf()
# 画花朵
lt(90)
fd(130)
color('black','red')
for i in range(12):
    drawLeaf()
    lt(360/12)   
# 画花心的圆圈
pu()
lt(90)
fd(-10)
rt(90)
pd()
color('black','yellow')
begin_fill()
circle(10)    
end_fill()
hideturtle()
done()

 

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5072077.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-16
下一篇 2022-11-16

发表评论

登录后才能评论

评论列表(0条)

保存