Making Traffic Signal Using Python


 #Making Traffic Signal Using Python.....

import turtle as t

t.bgcolor('light blue')
t.speed('slowest')
t.hideturtle()

t.delay(0)

t.pencolor('')
t.goto(-150,100)

t.fillcolor('black')
t.begin_fill()
t.pencolor('gray')
t.forward(150)
t.right(90)
t.forward(325)
t.right(90)  
t.forward(150)
t.right(90)
t.forward(325)
t.right(90)
t.end_fill()

t.delay(0)

t.pencolor('')
t.goto(-75,0)

t.fillcolor('gray')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(0)

t.pencolor('')
t.goto(-75,-100)

t.fillcolor('gray')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(0)
t.pencolor('')
t.goto(-75,-200)

t.fillcolor('gray')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(1)

t.pencolor('')
t.goto(-75,0)

t.fillcolor('red')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(14)

t.pencolor('')
t.goto(-75,0)

t.fillcolor('gray')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(1)

t.pencolor('')
t.goto(-75,-100)

t.fillcolor('yellow')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(15)

t.pencolor('')
t.goto(-75,-100)

t.fillcolor('gray')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(1)

t.pencolor('')
t.goto(-75,-200)

t.fillcolor('green')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(10)

t.pencolor('')
t.goto(-75,-200)

t.fillcolor('gray')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(1)

t.pencolor('')
t.goto(-75,0)

t.fillcolor('red')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(14)

t.pencolor('')
t.goto(-75,0)

t.fillcolor('gray')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(1)

t.pencolor('')
t.goto(-75,-100)

t.fillcolor('yellow')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(15)

t.pencolor('')
t.goto(-75,-100)

t.fillcolor('gray')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(1)

t.pencolor('')
t.goto(-75,-200)

t.fillcolor('green')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(10)

t.pencolor('')
t.goto(-75,-200)

t.fillcolor('gray')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(1)

t.pencolor('')
t.goto(-75,0)

t.fillcolor('red')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(1)

t.pencolor('')
t.goto(-75,-100)

t.fillcolor('yellow')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.delay(1)

t.pencolor('')
t.goto(-75,-200)

t.fillcolor('green')
t.begin_fill()
t.pencolor('white')
t.circle(35)
t.end_fill()

t.done()



...Output...

Comments

Popular posts from this blog

Making Snake Game Using Python

Match (Switch) statement in python

Arithmetic Operators in python with example