This commit is contained in:
Voussoir 2015-06-30 14:23:42 -07:00
parent e9b4789442
commit 8c3064b3c7
2 changed files with 52 additions and 4 deletions

48
Hexclock/hexclock.py Normal file
View file

@ -0,0 +1,48 @@
import math
import tkinter
import time
SHIFT_SPEED = 0.2
degree = 359
r = 0
g = 0
b = 0
def cval(degree, hueshift):
y = math.sin(math.pi*(degree+hueshift)/180)
# Anything above 50% becomes 100%
# 0 - 50% will scale as if it was 50 - 100%
y = (y+0.5) * 256
y = min(255, y)
y = max(0, y)
y = round(y)
return y
def clocking():
x = time.time()
x *= SHIFT_SPEED
r = cval(x, 90)
g = cval(x, 210)
b = cval(x, 330)
rgb = '#%02x%02x%02x' % (r,g,b)
#print(x, rgb)
#t.configure(bg=rgb)
l.configure(text=rgb, bg=rgb)
t.after(50, clocking)
t = tkinter.Tk()
l = tkinter.Label(text='')
l.pack(expand=True, fill='both')
w = 450
h = 350
screenwidth = t.winfo_screenwidth()
screenheight = t.winfo_screenheight()
windowwidth = w
windowheight = h
windowx = (screenwidth-windowwidth) / 2
windowy = ((screenheight-windowheight) / 2) - 27
geometrystring = '%dx%d+%d+%d' % (windowwidth, windowheight, windowx, windowy)
t.geometry(geometrystring)
clocking()
t.mainloop()

View file

@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.25"
inkscape:cx="100.54841"
inkscape:cy="407.95322"
inkscape:zoom="1"
inkscape:cx="379.35693"
inkscape:cy="763.59064"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
@ -60,7 +60,7 @@
style="opacity:1">
<path
style="opacity:1;fill:#000000;fill-opacity:1"
d="m 80.142305,848.37459 -0.59621,-636.86346 302.582785,-95.35941 302.56645,95.36062 0,636.86361 -302.56645,90.20612 z m 367.464845,-11.11929 0.14603,-152.8375 82.31724,-43.58919 -0.0387,-226.14639 -82.27952,-40.6523 -0.0483,-154.9308 -65.58054,-20.86146 -65.59819,20.86146 -0.0435,154.93172 -82.28165,40.65138 -0.0338,226.14639 82.31733,43.58919 0.14555,152.83605 65.49476,20.95038 z m -179.39416,-208.05288 0.0435,-199.95504 113.8743,-56.23072 113.85859,56.22535 -0.0614,200.0077 -113.79713,52.9042 z m 178.88016,-34.00654 0,-132.34272 -64.96427,-35.2506 -64.97543,35.2506 0,132.33691 64.97543,31.34161 z m -106.34111,-21.5374 0,-89.26516 41.23294,-25.08856 0.28819,0.16198 41.21645,24.92131 -0.0435,89.30094 -41.31872,23.31908 z m -78.64561,124.80961 -74.69782,-33.47852 0,-271.35023 74.75952,-38.94052 -0.0193,-120.52286 -109.85684,34.75217 0,516.87152 109.77459,33.45169 z m 349.84434,87.33268 0,-258.43632 0,-258.43632 -109.85713,-34.75217 -0.0193,120.52286 74.75957,38.93965 0,271.34931 -74.75957,33.48045 -0.0435,120.78398 z"
d="m 80.142305,848.37459 -0.59621,-636.86346 302.582785,-95.35941 302.56645,95.36062 0,636.86361 -302.56645,90.20625 z m 367.464845,-11.12039 0.14603,-152.8364 82.31724,-43.58919 -0.0387,-226.14639 -82.27952,-40.65102 -0.0483,-154.93208 -65.5749,-20.86146 -65.60383,20.86146 -0.0435,154.93172 -82.28165,40.65138 -0.0338,226.14639 82.31733,43.58919 0.14555,152.83605 65.4999,20.95038 z M 268.21299,629.20242 268.25649,429.24738 382.129,373.01666 495.98938,429.2472 495.92798,629.2002 382.129,682.15391 Z m 178.88016,-34.01222 0,-132.33704 -64.96427,-35.2506 -64.97543,35.2506 0,132.33691 64.97543,32.37813 z m -106.34111,-21.532 0,-89.26488 41.23294,-25.08856 0.28819,0.16198 41.21645,24.92646 -0.0435,89.265 -41.31872,23.34987 z m -78.64561,124.80989 -74.69782,-33.47852 0,-271.35023 74.75952,-38.94052 -0.0193,-120.52286 -109.85684,34.75217 0,516.87152 109.77459,33.45169 z m 349.84434,87.33111 0,-258.43475 0,-258.43632 -109.85713,-34.75217 -0.0193,120.52286 74.75957,38.94238 0,271.348 -74.75957,33.47903 -0.0435,120.78297 z"
id="path4241"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB