Simple Python Turtle Graphic and Code: Spark 1

Описание к видео Simple Python Turtle Graphic and Code: Spark 1

A group of sparklets emanating from the center of the spark image.

Feel free to copy the simple Python Turtle code that is given below. Don't hesitate to ask questions about the code if you have any. Enjoy! Please comment, like, or subscribe :)

Incidentally, for manually colorable graphics and variations, please visit my author site at https://www.amazon.com/author/basicpy...

import turtle
t = turtle.Turtle() #Definitions and Initializations
screen = turtle.Screen()
t.pensize(6) #Changeable
graphic_size = 160 #Changeable to a number close to 160
t.penup() #Python_Graphic start of drawing procedure
t.goto(-180, -25) #Anchor point of graphic
t.forward(graphic_size) #Trail-less movement of turtle over a distance graphic_size
t.left(175) #Turtle rotation to start drawing
t.pendown() #Start of drawing
for i in range(10): #Loop to draw 10 sparklets
t.pencolor("yellow") #Changeable
t.circle(-1.2 * graphic_size, 25) #Inner half of first sparklet stem
t.pencolor("orange") #Changeable
t.circle(-1.2 * graphic_size, 35) #Outer half of first sparklet stem
t.left(130) #Turtle rotation to start drawing of sparklet crown
t.pencolor("red") #Changeable
t.circle(-0.6 * graphic_size, 60) #First half of sparklet crown
t.left(139)
t.circle(-0.6 * graphic_size, 60) #Second half of sparklet crown
t.left(140) #Turtle rotation to draw second sparklet stem
t.pencolor("orange") #Changeable
t.circle(-1.2 * graphic_size, 35) #Outer half of second sparklet stem
t.pencolor("yellow") #Changeable
t.circle(-1.2 * graphic_size, 25) #Inner half of second sparklet stem
t.left(155) #Turtle rotation to start drawing the next sparklet
t.hideturtle()
screen.exitonclick()

Комментарии

Информация по комментариям в разработке