Python Logo Using Turtle in Python

import turtle

turtle_cursor = turtle.Turtle()

turtle_screen = turtle.Screen()

def pause():

    turtle_cursor.speed(2)

    for i in range(100):

        turtle_cursor.left(90)

def upper_dot_of_python_logo():

    turtle_cursor.penup()

    turtle_cursor.right(90)

    turtle_cursor.forward(160)

    turtle_cursor.left(90)

    turtle_cursor.forward(70)

    turtle_cursor.pencolor("white")

    turtle_cursor.dot(35)

def second_position():

    turtle_cursor.penup()

    turtle_cursor.forward(20)

    turtle_cursor.right(90)

    turtle_cursor.forward(10)

    turtle_cursor.right(90)

    turtle_cursor.pendown()

def half():

    turtle_cursor.forward(50)

    draw_side_curve_of_python_logo()

    turtle_cursor.forward(90)

    draw_first_left_curve_of_python_logo()

    turtle_cursor.forward(40)

    turtle_cursor.left(90)

    turtle_cursor.forward(80)

    turtle_cursor.right(90)

    turtle_cursor.forward(10)

    turtle_cursor.right(90)

    turtle_cursor.forward(120)  

    draw_second_left_curve_of_python_logo()

    turtle_cursor.forward(30)

    turtle_cursor.left(90)

    turtle_cursor.forward(50)

    draw_right_curve_of_python_logo()

    turtle_cursor.forward(40)

    turtle_cursor.end_fill()

def lower_dot_of_python_logo():

    turtle_cursor.left(90)

    turtle_cursor.penup()

    turtle_cursor.forward(310)

    turtle_cursor.left(90)

    turtle_cursor.forward(120)

    turtle_cursor.pendown()

    turtle_cursor.dot(35)

def draw_first_left_curve_of_python_logo():

    draw_side_curve_of_python_logo()

    turtle_cursor.forward(80)

    draw_side_curve_of_python_logo()

def draw_second_left_curve_of_python_logo():

    draw_side_curve_of_python_logo()

    turtle_cursor.forward(90)

    draw_side_curve_of_python_logo()

def draw_side_curve_of_python_logo():

    for i in range(90):

        turtle_cursor.left(1)

        turtle_cursor.forward(1)

def draw_right_curve_of_python_logo():

    for i in range(90):

        turtle_cursor.right(1)

        turtle_cursor.forward(1)

turtle_cursor.pensize(2)

turtle_cursor.speed(10)

turtle_cursor.pensize(2)

turtle_cursor.pencolor("black")

turtle_screen.bgcolor("white")

turtle_cursor.fillcolor("#306998")

turtle_cursor.begin_fill()

half()

turtle_cursor.end_fill()

second_position()

turtle_cursor.fillcolor("#FFD43B")

turtle_cursor.begin_fill()

half()

turtle_cursor.end_fill()

upper_dot_of_python_logo()

lower_dot_of_python_logo()

pause

No comments: