def kwiatek(r):
numPow = 1
turtle.colormode(255)
turtle.fillcolor(238, 255, 0)
ustDoKolka(r)
turtle.begin_fill()
turtle.circle(r)
turtle.end_fill()
ustDoPlatkow(r)
while numPow <= 12:
turtle.pu()
turtle.fd(r)
turtle.pd()
trojkat(r)
turtle.pu()
turtle.fd(r)
turtle.rt(180)
turtle.rt(360/12)
numPow = numPow + 1
python类circle()的实例源码
def tscheme_circle(r, extent=None):
"""Draw a circle with center R units to the left of the turtle (i.e.,
right if N is negative. If EXTENT is not None, then draw EXTENT degrees
of the circle only. Draws in the clockwise direction if R is negative,
and otherwise counterclockwise, leaving the turtle facing along the
arc at its end."""
if extent is None:
_check_nums(r)
else:
_check_nums(r, extent)
_tscheme_prep()
turtle.circle(r, extent and extent)
return okay
def tscheme_circle(r, extent = None):
"""Draw a circle with center R units to the left of the turtle (i.e.,
right if N is negative. If EXTENT is not None, then draw EXTENT degrees
of the circle only. Draws in the clockwise direction if R is negative,
and otherwise counterclockwise, leaving the turtle facing along the
arc at its end."""
if extent is None:
_check_nums(r)
else:
_check_nums(r, extent)
_tscheme_prep()
turtle.circle(r, extent and extent)
return okay
def tscheme_circle(r, extent = None):
"""Draw a circle with center R units to the left of the turtle (i.e.,
right if N is negative. If EXTENT is not None, then draw EXTENT degrees
of the circle only. Draws in the clockwise direction if R is negative,
and otherwise counterclockwise, leaving the turtle facing along the
arc at its end."""
if extent is None:
_check_nums(r)
else:
_check_nums(r, extent)
_tscheme_prep()
turtle.circle(r, extent and extent)
return okay
def glowaWonsza(bok, bokPrzekatna, kat):
turtle.colormode(255)
szesciokat(bok, bokPrzekatna, kat)
turtle.pu() ##Start
turtle.lt(180)
turtle.pd()
naGoreWielokata(bok, bokPrzekatna, kat)
turtle.pu()
turtle.lt(180)
turtle.fd(bok)
turtle.fillcolor(206, 136, 22)
turtle.begin_fill()
turtle.rt(90)
turtle.circle(5)
turtle.lt(90)
turtle.end_fill()
turtle.fillcolor(251, 255, 135)
turtle.bk(bok)
turtle.pd()
naGoreWielokata(bok, bokPrzekatna, kat)
turtle.pu()
turtle.lt(90)
turtle.pd() ##Koniec
szesciokat(bok, bokPrzekatna, kat)
turtle.rt(180)
naGoreWielokata(bok, bokPrzekatna, kat)
turtle.rt(90)