Page 1 of 1

Date & Time on Control Pages

PostPosted: Sun Dec 11, 2016 10:06 am
by jalves
In order to have the current day, date & time available to display on various control pages I have a schedule set to run every minute that updates a variable for time and I have a schedule set to run at midnight for day & date variables. I then display these variables in some of by control pages. I had set these up under a prior iteration of Indigo and was wondering if there's a more efficient way of doing this now under Indigo 7?

Basically I guess I'm wondering if there is a way to simply access Indigo day/date/time directly for display on the pages without the intermediate step of saving to a variable.

Re: Date & Time on Control Pages

PostPosted: Sun Dec 11, 2016 10:22 am
by Different Computers
I bet there's a way to make python output a refreshing image clock. Something likethis, but this example is probably too complex.

Found this, which creates a floating digital clock window.

Code: Select all
from Tkinter import *
import time

root = Tk()
time1 = ''
clock = Label(root, font=('times', 20, 'bold'), bg='green')
clock.pack(fill=BOTH, expand=1)

def tick():
global time1
# get the current local time from the PC
time2 = time.strftime('%H:%M:%S')
# if time string has changed, update it
if time2 != time1:
time1 = time2
clock.config(text=time2)
# calls itself every 200 milliseconds
# to update the time display as needed
# could use >200 ms, but display gets jerky
clock.after(200, tick)

tick()
root.mainloop( )

Re: Date & Time on Control Pages

PostPosted: Sun Dec 11, 2016 11:31 am
by Colorado4Wheeler
I wrote a plugin called LCD Creator that allows you to create an LCD device that is a date and/or time and displays it on your control pages as a graphic - I don't know if that's of interest but it is out there.