用python的turtle库画一个python的logo
代码如下(示例):
import turtle as t
t. colormode ( 255 )
t. speed ( 10 )
t. pensize ( 3 )
t. pu ( )
t. goto ( - 200 , 105 )
# 蓝色区域
t. pencolor ( 54 , 110 , 157 )
t. fillcolor ( 54 , 110 , 157 )
t. begin_fill ( )
t. goto ( - 225 , - 115 )
t. pd ( )
t. seth ( 90 )
t. fd ( 55 )
t. circle ( - 50 , 90 )
t. fd ( 190 )
t. circle ( 50 , 90 )
t. fd ( 100 )
t. circle ( 85 , 90 )
t. fd ( 100 )
t. circle ( 85 , 90 )
t. fd ( 30 )
t. left ( 90 )
t. fd ( 150 )
t. seth ( 270 )
t. fd ( 20 )
t. right ( 90 )
t. fd ( 220 )
t. circle ( 50 , 90 )
t. fd ( 105 )
t. circle ( 50 , 90 )
t. fd ( 50 )
t. left ( 90 )
t. end_fill ( )
t. fillcolor ( 255 , 255 , 255 )
t. pu ( )
t. goto ( - 125 , 155 )
t. pd ( )
t. pencolor ( 255 , 255 , 255 )
t. begin_fill ( )
t. circle ( 20 , 360 )
t. end_fill ( )
# 黄色区域
t. pu ( )
t. goto ( 85 , 80 )
t. pd ( )
t. pencolor ( 255 , 212 , 69 )
t. fillcolor ( 255 , 212 , 69 )
t. begin_fill ( )
t. seth ( 270 )
t. fd ( 55 )
t. circle ( - 50 , 90 )
t. fd ( 190 )
t. circle ( 50 , 90 )
t. fd ( 100 )
t. circle ( 85 , 90 )
t. fd ( 100 )
t. circle ( 85 , 90 )
t. fd ( 30 )
t. left ( 90 )
t. fd ( 150 )
t. right ( 90 )
t. fd ( 20 )
t. right ( 90 )
t. fd ( 220 )
t. circle ( 50 , 90 )
t. fd ( 105 )
t. circle ( 50 , 90 )
t. fd ( 50 )
t. end_fill ( )
t. fillcolor ( 255 , 255 , 255 )
t. pu ( )
t. goto ( - 10 , - 180 )
t. pd ( )
t. pencolor ( 255 , 255 , 255 )
t. begin_fill ( )
t. circle ( 20 , 360 )
t. end_fill ( )
t. done ( )