HOW TO MAKE BEAUTIFUAL DESIGN USING TURTLE (SOUCRE CODE IS AVAILABLE )

  

BEAUTIFUL  DESIGN USING TURTLE IN PYTHON 🐒









     πŸ‘‰ how to create Many Beautiful Designs using Python Turtle in the same code. The code for the turtle program is given below. Accordingly, this article will explain to you how you can code in turtles that will allow you to create some cool designs. We will first see the code and then, we will understand it line-by-line. Now let’s see the code for design.


    πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡  CODE :

import turtle

wn=turtle.Screen()

turtle.bgcolor('black')

turtle.shape('turtle')

tr=turtle.Turtle()

ts=turtle.Turtle()

tt=turtle.Turtle()

t2=turtle.Turtle()

t3=turtle.Turtle()

t4=turtle.Turtle()

t5=turtle.Turtle()

move=1

###############################

t5.speed("fastest")

for i in range(10):

    for i in range(4):

          t5.pu()

          t5.goto(500,200)

          t5.pd()

          t5.color('cyan')

          t5.pensize(3)

          t5.circle(50,steps=4)

          t5.right(100)

t5.speed("fastest")

for i in range(6):

    for i in range(4):

          t5.pu()

          t5.goto(0,0)

          t5.pd()

          t5.color('light green')

          t5.pensize(3)

          t5.circle(100,steps=6)

          t5.right(100)

t2.speed("fastest")

for i in range (10):

    for i in range (2):

        t2.pensize(5)

        t2.goto(270,0)

        t2.color("green")

        t2.forward(100)

        t2.right(60)

        t2.color("cyan")

        t2.forward(50)

        t2.right(120)

    t2.right(30)

tr.speed("fastest")

for i in range (10):

    for i in range (2):

        tr.pensize(7)

        tr.goto(-270,0)

        tr.color("purple")

        tr.forward(100)

        tr.circle(5,steps=4)

        tr.right(60)

        tr.color("violet")

        tr.forward(50)

        tr.right(120)

    tr.right(30)

ts.speed("fastest")

t5.speed("fastest")

for i in range(10):

    for i in range(4):

          t5.pu()

          t5.goto(-500,200)

          t5.pd()

          t5.color('yellow')

          t5.pensize(3)

          t5.circle(50,steps=4)

          t5.right(100)

t5.speed("fastest")

for i in range(10):

    for i in range(4):

          t5.pu()

          t5.goto(-500,-200)

          t5.pd()

          t5.color('white')

          t5.pensize(3)

          t5.circle(50,steps=3)

          t5.right(100)

t5.speed("normal")

for i in range(10):

    for i in range(4):

          t5.pu()

          t5.goto(500,-200)

          t5.pd()

          t5.color('pink')

          t5.pensize(3)

          t5.circle(50,steps=3)

          t5.right(100)

for i in range (20):

    for i in range (2):

        ts.pensize(2)

        ts.goto(0,300)

        ts.color("red")

        ts.forward(100)

        ts.circle(6,steps=3)

        ts.right(70)

        ts.color("yellow")

        ts.forward(50)

        ts.right(120)

    ts.left(30)

ts.speed('fastest')

for i in range (20):

    for i in range (2):

        ts.pensize(2)

        ts.pu()

        ts.goto(0,-300)

        ts.color("pink")

        ts.pd()

        ts.forward(100)

        ts.circle(6,steps=3)

        ts.right(70)

        ts.color("orange")

        ts.forward(50)

        ts.right(120)

    ts.left(30)

t3.speed("fastest")

for i in range (10):

    for i in range (2):

        t3.pensize(3)

        t3.goto(-320,300)

        t3.color("light green")

        t3.begin_fill()

        t3.forward(30)

        t3.right(50)

        t3.color("green")

        t3.forward(50)

        t3.circle(5,steps=6)

        t3.right(120)

        t3.end_fill()

    t3.right(60)

t3.speed("fastest")

for i in range (10):

    for i in range (2):

        t3.pensize(3)

        t3.pu()

        t3.goto(320,-300)

        t3.pd()

        t3.color("red")

        t3.begin_fill()

        t3.forward(30)

        t3.right(50)

        t3.color("orange")

        t3.forward(50)

        t3.circle(5,steps=6)

        t3.right(120)

        t3.end_fill()

    t3.right(100)

t3.speed("fastest")

for i in range (10):

    for i in range (2):

        t3.pensize(3)

        t3.pu()

        t3.goto(320,300)

        t3.pd()

        t3.color("light blue")

        t3.begin_fill()

        t3.forward(30)

        t3.right(50)

        t3.color("blue")

        t3.forward(50)

        t3.circle(5,steps=6)

        t3.right(120)

        t3.end_fill()

    t3.right(60)

t3.speed("fastest")

for i in range (10):

    for i in range (2):

        t3.pensize(3)

        t3.pu()

        t3.goto(-320,-300)

        t3.pd()

        t3.color("orange")

        t3.begin_fill()

        t3.forward(30)

        t3.right(50)

        t3.color("red")

        t3.forward(50)

        t3.circle(5,steps=6)

        t3.right(120)

        t3.end_fill()

    t3.right(60)

###########################

t5.speed("fastest")

for i in range(10):

    for i in range(4):

          t5.pu()

          t5.goto(600,0)

          t5.pd()

          t5.color('white')

          t5.pensize(1)

          t5.circle(40,steps=5)

          t5.right(100)

t5.speed("fastest")

############################

t5.speed("fastest")

for i in range(10):

    for i in range(4):

          t5.pu()

          t5.goto(600,0)

          t5.pd()

          t5.color('green')

          t5.pensize(1)

          t5.circle(20,steps=9)

          t5.right(100)

t5.speed("fastest")

painter = turtle.Turtle()

painter.pencolor("red")

for i in range(50):

    painter.pu()

    painter.goto(-600,0)

    painter.pd()

    painter.forward(100)

    painter.left(123)

turtle.done()








First Part

  • First of Many Beautiful Designs, import the turtle module and set “wn” variable as the turtle.Screen(). Then, set the background color to black and the shape to the turtle.
  • Second, set all the variables “tr”, “ts”, “tt”, “t2”, “t3”, “t4”, “t5” to turtle.Turtle(). Then set the value of “move” variable to 1.

Loops

  • Third, set the speed of t5 turtle to the fastest. Then create a for loop with the range of 10 and another for loop inside it with the range of 4. Call the pu() function, go to (500, 200) and call the pd() function. Set the color to cyan and pen size to 3. Create a circle with value 50 and steps to 4. Finally, move to the right at an angle of 100 degrees.
  • Likewise, create a loop with a range of 6 and another on inside it with a range of 4. Here, the “t2” variable is taken. Now, set the pen size to 5, go to (270, 0), and color to green. Likewise, Move forward with the value of 100 and right at an angle of 60 degrees. Set the color to cyan and again move forward with the value of 50 and right at an angle of 120. The move is right at an angle of 30.

More loops

  • Fourth, set the speed of the “tr” turtle to the fastest. Now, create a loop with a range of 10 and another one inside it with a range of 2. Similarly, set the pen size to 7 and go to (-270, 0) which is exactly on the other side than the above one. Then set the color to purple and move forward with the value of 100. Call the circle() with argument 5 and steps as 4. Move the turtle right at an angle of 60. Moreover, set the color to violet, move forward at 50 and right at 120.
  • Fifth, set the speed of t5 to fastest and create a for loop with the range of 10 and another one inside it with the range of 4. Call the pu() function and go to (-500. 200). Then call the pd() and set the color to yellow, pen size to 3, and circle to 50 with the steps of 4. Move the turtle right at 100.

Even more loops

  • Sixth and similarly, set the speed of the t5 to fastest and create a for loop of range 10 and another one with the range of 4. Call the pu() function and go to (-500, 200). This is exactly in another quadrant than before. Then pu the pen down and set the color to white and pen size to 3. Create a circle with the value 50 and 3 steps. Move 100 degrees right and end the loop.
  • Seventh, set the speed of the t5 turtle to normal and create a for loop with the range of 10 and another one inside it with the range of 4. Call the pu() function and go to (500, -200). Then put the pen down and set the color to pink and pen size to 3. Create a circle with the value of 50 and steps of 3. Lastly, move the turtle right at an angle of 100 degrees.

Last Part

  • All 5 turtles have a similar code which you can see in the code. Lastly, create a “painter” turtle and set the pen color to red. Then start a for loop with the range of 50. And call the function pu() and go to (-600, 0) and put the pen down. Draw the turtle forward with the value of 100 and left at an angle of 123.

Comments

Popular posts from this blog

HANDWRITTEN NOTES (COMPUTER NETWORK ) USEFULL IN EXAMS (IMP TOPICS)

SESSION LAYER IN COMPUTER NETWORK

DATA STRUCTURE (IMP QUESTIONS )FOR (BE STUDENTS ,DIPLOMA STUNDENTS,UNIVERSITY) (CHEPTAR WISE )