SHARE
TWEET

Untitled

a guest Apr 24th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import turtle
  2. import time
  3.  
  4. wn = turtle.Screen()
  5. wn.bgcolor("black")
  6. wn.setup(width=600, height=600)
  7. wn.title("Adrian's Analog Cock")
  8. wn.tracer(0)
  9.  
  10. pen = turtle.Turtle()
  11. pen.hideturtle()
  12. pen.speed(0)
  13. pen.pensize(3)
  14.  
  15. def draw_clock(h, m, s , pen):
  16.     pen.up()
  17.     pen.goto(0, 210)
  18.     pen.setheading(180)
  19.     pen.color("red")
  20.     pen.pendown()
  21.     pen.circle(210)
  22.  
  23.     pen.penup()
  24.     pen.goto(0, 0)
  25.     pen.setheading(90)
  26.  
  27.  
  28.  
  29.     for _ in range(12):
  30.         pen.fd(190)
  31.         pen.pendown()
  32.         pen.fd(20)
  33.         pen.penup()
  34.         pen.goto(0, 0)
  35.         pen.rt(30)
  36.     #Hour hand
  37.     pen.penup()
  38.     pen.goto(0, 0)
  39.     pen.color("green")
  40.     pen.setheading(90)
  41.     angle = (h / 12) * 360
  42.     pen.rt(angle)
  43.     pen.pendown()
  44.     pen.fd(160)
  45.     #Min Hand
  46.     pen.penup()
  47.     pen.goto(0, 0)
  48.     pen.color("white")
  49.     pen.setheading(90)
  50.     angle = (m / 60) * 360
  51.     pen.rt(angle)
  52.     pen.pendown()
  53.     pen.fd(130)
  54.  
  55.     #Seconds Hand
  56.     pen.penup()
  57.     pen.goto(0, 0)
  58.     pen.color("blue")
  59.     pen.setheading(90)
  60.     angle = (s / 60) * 360
  61.     pen.rt(angle)
  62.     pen.pendown()
  63.     pen.fd(100)
  64. while True:
  65.      h = int(time.strftime("%I"))
  66.      m = int(time.strftime("%M"))
  67.      s = int(time.strftime("%S"))
  68.  
  69.      draw_clock(h, m, s, pen)
  70.      wn.update()
  71.  
  72.      time.sleep(1)
  73.  
  74.  
  75.      pen.clear()
  76.  
  77.  
  78. wn.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top