五星红旗
import turtle
import mathturtle. pensize( 3 )
turtle. colormode( 255 )
turtle. pencolor( "#ed120c" )
turtle. fillcolor( "#ed120c" )
turtle. begin_fill( )
turtle. penup( )
turtle. goto( - 150 , 100 )
turtle. pendown( ) for i in [ 300 , 200 , 300 , 200 ] : turtle. forward( i) turtle. right( 90 )
turtle. left( 90 )
turtle. end_fill( )
turtle. penup( )
def Pentagram ( x, y, radius, degree) : length = ( radius * math. sqrt( 8 ) // 3 ) * 2 turtle. goto( x, y) turtle. left( degree) turtle. forward( radius) turtle. pendown( ) turtle. right( 162 ) turtle. pencolor( "#f4ec20" ) turtle. fillcolor( "#f4ec20" ) turtle. begin_fill( ) for _ in range ( 5 ) : turtle. forward( length) turtle. right( 144 ) turtle. end_fill( ) turtle. left( 162 ) turtle. right( degree) turtle. penup( )
Pentagram( - 100 , 50 , 30 , 0 )
degree1 = 90 + math. atan( 3 / 5 ) * 180 / math. pi
Pentagram( - 50 , 80 , 10 , degree1)
degree2 = 90 + math. atan( 1 / 7 ) * 180 / math. pi
Pentagram( - 30 , 60 , 10 , degree2)
degree3 = 90 - math. atan( 2 / 7 ) * 180 / math. pi
Pentagram( - 30 , 30 , 10 , degree3)
degree4 = 90 - math. atan( 4 / 5 ) * 180 / math. pi
Pentagram( - 50 , 10 , 10 , degree4) turtle. hideturtle( )
turtle. done( )