def update_time():
'''
update the clock display. This will be called once very second by the repeat task. It
does need to yield at the end to allow time-slicing, however
'''
now = datetime.datetime.now().time()
time_string = now.strftime("%-I:%M %S %p")
hours, seconds, ampm = time_string.split()
hour_style = "font-size:64px; font-family: Impact; color: #8A0F21"
sec_style = "font-size:18px; font-family:Arial Black; color: #8A0F21"
am_style = "font-size:24px; font-family:Arial Black; font-weight:900; color: #700D21"
def set_control (ctl, value, style):
def make_text(text, style):
return '<span style="{0}">{1}</span>'.format(style, text)
cmds.text(ctl, e=True, label = make_text(value, style))
set_control(hour, hours, hour_style)
set_control(secs, seconds, sec_style)
set_control(am, ampm, am_style)
yield
# set up the update job to repeat every second
评论列表
文章目录