Skip to content

Instantly share code, notes, and snippets.

@jrabbit
Created October 5, 2010 04:31
Show Gist options
  • Save jrabbit/610996 to your computer and use it in GitHub Desktop.
Save jrabbit/610996 to your computer and use it in GitHub Desktop.
Kilosecond Clocks.
import Image, ImageDraw
import time
im = Image.open("kilosec_round.PNG")
draw = ImageDraw.Draw(im)
def kiloseconds():
tm = time.localtime()
return (tm.tm_hour*3600+tm.tm_min*60+tm.tm_sec)/1000.0
#http://github.com/api/v2/json/blob/show/bavardage/kiloseconds/03fac33ed6be1f0a004319cf7b8449d6d5fb10f3
#draw.line((im.size[0]/2, im.size[1]) + (im.size[0]/2,0), fill=128, width=16)
#draw.line((im.size[0]/2, im.size[1]) + (im.size[0]/2,im.size[1]-((kiloseconds()/86.4)*im.size[1])), fill="#E67300", width=10)
draw.arc(im.size, 0, (kiloseconds()/86.4)*360, outline="#E67300")
#del draw
im.save("kiloclock_round.png")
im.show()
import Image, ImageDraw
import time
im = Image.open("kilosec.PNG")
draw = ImageDraw.Draw(im)
def kiloseconds():
tm = time.localtime()
return (tm.tm_hour*3600+tm.tm_min*60+tm.tm_sec)/1000.0
#http://github.com/api/v2/json/blob/show/bavardage/kiloseconds/03fac33ed6be1f0a004319cf7b8449d6d5fb10f3
draw.line((im.size[0]/2, im.size[1]) + (im.size[0]/2,0), fill=128, width=16)
draw.line((im.size[0]/2, im.size[1]) + (im.size[0]/2,im.size[1]-((kiloseconds()/86.4)*im.size[1])), fill="#E67300", width=10)
#del draw
im.save("kiloclock.png")
im.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment