I am working on a Python digital clock using the turtle module. However, it is throwing an error at line 41, column 12. Can someone help me identify and fix the issue?
I tried whatever can be done by my side but it seems not to be satisfying. Help me and there is a one more error saying syntax error at the font.
import turtle as tl
import time
import datetime as dt
#create a turtle to display time
t = tl.Turtle()
#create a turtle to create a rectangular box
t1 = tl.Turtle()
#create screen
s = tl.Screen()
s.bgcolor('black') #set background colour
sec = dt.datetime.now().second
min = dt.datetime.now().minute
hour = dt.datetime.now().hour
t1.pensize(3)
t1.color('white')
t1.penup()
# set the position of the turtle
t1.goto(-20, 0)
t1.pendown()
#create rectangular box
for r in range(2):
t1.forward(200)
t1.left(90)
t1.forward(70)
t1.left(90)
# hide the turtle
t1.hideturtle()
while True:
t.hideturtle()
t.clear()
#display the time
t.write(str(hour).zfill(2)
+ ":" + str(min).zfill(2)
+ ":" + str(sec).zfill(2),
font=('Arial Narrow', 35, 'bold'))
time.sleep(1)
sec += 1
if sec == 60:
sec = 0
min += 1
if min == 60:
min = 0
hour += 1
if hour == 12:
hour = 0