This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Sunday, January 22, 2023

Python Turtle Graphics 08

 


import turtle


tu = turtle.Turtle()

tu.screen.bgcolor("black")

tu.pensize(2)

tu.color("green")

tu.left(90)

tu.backward(100)

tu.speed(100)

tu.shape('turtle')


def tree(i):

    if i<10:

        return

    else:

        tu.forward(i)

        tu.color("orange")

        tu.circle(2)

        tu.color("brown")

        tu.left(30)

        tree(3*i/4)

        tu.right(60)

        tree(3*i/4)

        tu.left(30)

        tu.backward(i)

tree(100)

turtle.done()


Python Turtle Graphics 07

 


from turtle import*

import colorsys

tracer(100)

bgcolor("black")

h=0.7

c=colorsys.hsv_to_rgb(h,1,1)

pensize(4)

def a():

    global h

    for i in range(4):

        c=colorsys.hsv_to_rgb(h,1,1)

        fillcolor(c)

        h+=0.004

        begin_fill()

        fd(50)

        right(20)

        fd(40)

        right(9)

        end_fill()

for i in range(400):

    a()

    goto(0,0)

    rt(1)


Python Turtle Graphics 06

 


import turtle


turtle.Screen().bgcolor("black")


t = turtle.Turtle()

t.speed(10)

t.pensize(10)

t.penup()


def draw_circle():

    t.setposition(0,-280)

    t.pendown()

    t.begin_fill()

    t.color('red')

    t.pencolor("white")

    t.circle(300)

    t.end_fill()

    t.penup()


def draw_circle2():

    t.pensize(2)

    t.setposition(0,-230)

    t.pendown()

    t.begin_fill()

    t.color('black')

    t.circle(250)

    t.end_fill()

    t.penup()

    

def draw_A():

    t.setposition(30,-110)

    t.pendown()

    t.begin_fill()

    t.color("red")

    t.pensize(10)

    t.pencolor("white")

    t.forward(23)

    t.backward(123)

    t.left(60)

    t.backward(220)

    t.right(60)

    t.backward(100)

    t.right(117)

    t.backward(710)

    t.right(63)

    t.backward(110)

    t.right(90)

    t.backward(510)

    t.right(90)

    t.backward(100)

    t.right(90)

    t.backward(70)

    t.end_fill()

    t.penup()


def draw_triangle():

    t.pensize(10)

    t.setposition(53,-40)

    t.pendown()

    t.begin_fill()

    t.color("black")

    t.pencolor("white")

    t.right(90)

    t.forward(100)

    t.right(115)

    t.forward(250)

    t.right(157)

    t.forward(227)

    t.end_fill()


def draw_arrow():

    t.backward(80)

    t.left(42)

    t.forward(147)

    t.right(83)

    t.forward(140)


draw_circle()

draw_circle2()

draw_A()

draw_triangle()

draw_arrow()


t.hideturtle()

turtle.done()


Python Turtle Graphics 05

 


import turtle as t

import colorsys as c


t.tracer(20)

t.bgcolor('black')

t.setpos(0, -230)

r = 0

t.setup(800, 600)

t.width(20)

t.ht()

for i in range(2000):

    r += 0.01

    color = c.hsv_to_rgb(r, 1, 1)

    t.fillcolor(color)

    t.begin_fill()

    t.circle(i, 120)

    t.circle(90, 90)

    t.circle(i, 120)

    t.end_fill()

t.done()


Python Turtle Graphics 04

 


import turtle

from turtle import *


wn = Screen()

wn.setup(width=1200, height=680)

t = Turtle()

wn.bgcolor('black')

t.speed(0)

colors = ['white','red']


for i in range(180):

    t.pencolor(colors[i%len(colors)])

    t.rt(i)

    t.circle(100,i)

    t.fd(i)

    t.rt(180)

    t.fd(i)


wn.mainloop()


Python Turtle Graphics 03

 


import turtle

a = turtle.Turtle()

a.getscreen().bgcolor("black")


a.penup()

a.goto(-200, 100)

a.pendown()

a.color("yellow")


a.speed(25)

def star(turtle, size):

    if size<=10:

        return

    else:

        turtle.begin_fill()

        for i in range(5):

            turtle.forward(size)

            star(turtle,size/3)

            turtle.left(216)

            turtle.end_fill()


star(a, 360)

turtle.done()


Python Turtle Graphics 02


 import turtle

turtle.bgcolor("black")


squary = turtle.Turtle()

squary.speed(20)

squary.pencolor("red")

for i in range(400):

    squary.forward(i)

    squary.left(91)


Python Turtle Graphics 01


 

import turtle

wn=turtle.Screen().bgcolor('black')


k1=turtle.Turtle()

k1.goto(0,200)

a=0

b=0

k1.speed(10)

k1.pencolor('red')

while True:

    k1.forward(a)

    k1.right(b)

    a=a+3

    b=b+1

    if b==210:

        break

    k1.hideturtle()


Python Amazing Turtle Graphics