generated from mwc/project_drawing
I added the numbers 1-12 on the clock. I struggled with finding the position of the numbers. In my next submit, I want to make the hands move like a clock, but I am afraid that I will not be able to get them to move over 60 seconds like a regular clock does.
This commit is contained in:
25
drawing.py
25
drawing.py
@@ -3,21 +3,32 @@
|
||||
# By ____(you)___________
|
||||
#
|
||||
# (Briefly describe what this program does.)
|
||||
|
||||
import turtle
|
||||
from turtle import *
|
||||
def draw_clock():
|
||||
screen = turtle.Screen()
|
||||
screen.setup(width=600, height=600)
|
||||
screen.bgcolor("lightgray")
|
||||
t = turtle.Turtle()
|
||||
t.penup()
|
||||
t.speed(0)
|
||||
t.pensize(18)
|
||||
t.speed(0)
|
||||
t.pensize(14)
|
||||
t.color("black")
|
||||
t.goto(0, -200)
|
||||
t.pendown()
|
||||
RADIUS = 200
|
||||
t.circle(RADIUS)
|
||||
turtle.done()
|
||||
draw_clock()
|
||||
|
||||
t.circle(RADIUS)
|
||||
NUMBER_RADIUS = RADIUS - 30
|
||||
t = turtle.Turtle()
|
||||
t.penup()
|
||||
t.goto(5, -30)
|
||||
t.pensize(20)
|
||||
t.color("black")
|
||||
for hour in range(1, 13):
|
||||
angle = 30 * (3 - hour)
|
||||
t.setheading(angle)
|
||||
t.forward(NUMBER_RADIUS)
|
||||
t.write(str(hour), align = "center", font = ("Arial", 50, "bold"))
|
||||
t.backward(NUMBER_RADIUS)
|
||||
draw_clock()
|
||||
turtle.done()
|
||||
|
||||
Reference in New Issue
Block a user