Still trying....
This commit is contained in:
parent
ba63a319fd
commit
b2172fea91
|
@ -14,7 +14,7 @@ NUM_COLS = 5
|
||||||
|
|
||||||
def led_clock():
|
def led_clock():
|
||||||
def update_weather():
|
def update_weather():
|
||||||
api_key = "INSERT YOUR DARKSKY KEY HERE" # *** INSERT YOUR DARKSKY KEY HERE **
|
api_key = "bb9b798d340e413869ea72ac1bea9742" # *** INSERT YOUR DARKSKY KEY HERE **
|
||||||
lat = 35.738387
|
lat = 35.738387
|
||||||
lng = -79.203797
|
lng = -79.203797
|
||||||
forecast = forecastio.load_forecast(api_key, lat, lng)
|
forecast = forecastio.load_forecast(api_key, lat, lng)
|
||||||
|
@ -75,13 +75,12 @@ def led_clock():
|
||||||
min1 = window.FindElement('_min1_')
|
min1 = window.FindElement('_min1_')
|
||||||
min2 = window.FindElement('_min2_')
|
min2 = window.FindElement('_min2_')
|
||||||
|
|
||||||
last_update_time = 0
|
i = last_update_time = 0
|
||||||
i = 0
|
|
||||||
while True: # Event Loop
|
while True: # Event Loop
|
||||||
event, values = window.Read(timeout=1000)
|
event, values = window.Read(timeout=1000)
|
||||||
if event in (None, 'Exit'):
|
if event in (None, 'Exit'):
|
||||||
break
|
break
|
||||||
|
# update the clock
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
real_hour = now.hour - 12 if now.hour > 12 else now.hour
|
real_hour = now.hour - 12 if now.hour > 12 else now.hour
|
||||||
hour1_digit = led_digits[real_hour // 10]
|
hour1_digit = led_digits[real_hour // 10]
|
||||||
|
@ -94,6 +93,7 @@ def led_clock():
|
||||||
else:
|
else:
|
||||||
colon_elem.Update(data=ledblank[22:])
|
colon_elem.Update(data=ledblank[22:])
|
||||||
i += 1
|
i += 1
|
||||||
|
# update weather
|
||||||
if last_update_time == 0 or (now-last_update_time).seconds >= 60*60*6:
|
if last_update_time == 0 or (now-last_update_time).seconds >= 60*60*6:
|
||||||
print('*** Updating Weather ***')
|
print('*** Updating Weather ***')
|
||||||
last_update_time = now
|
last_update_time = now
|
||||||
|
|
Loading…
Reference in New Issue