Draw a Clock Dial in Python Using Turtle

Python Program to Draw a Clock Dial Using Turtle

# Draw a Clock Dial in Python Using Turtle
# import turtle
import turtle

screen=turtle.Screen()
trtl=turtle.Turtle()
screen.setup(620,620)
screen.bgcolor('white')
clr=['red','green','blue','yellow','purple']
trtl.pensize(4)
trtl.shape('turtle')
trtl.penup()
trtl.pencolor('green')
# print numbers
x=0
for i in range(12):
      x=x+1
      trtl.penup()
      trtl.setheading(-30*i+60)
      trtl.forward(150)
      trtl.pendown()
      trtl.forward(25)
      trtl.penup()
      trtl.forward(20)
      trtl.write(str(x),align="center",font=("Arial", 12, "normal"))
      if x==12:
        x=0
      trtl.home()

# Draw circle
trtl.home()
trtl.setpos(0,-250)
trtl.pendown()
trtl.pensize(10)
trtl.pencolor('red')
trtl.circle(250)
trtl.penup()
trtl.setpos(150,-270)
trtl.pendown()
trtl.pencolor('olive')
trtl.ht()

Output:

Draw a Clock Dial in Python Using Turtle

About The Author

Leave a Reply