def show_temp(): yahoo_weather = pywapi.get_weather_from_yahoo('78728', 'imperial') for ch in yahoo_weather['condition']['temp']: display.display_char_fade(ch, color_tools.random_rgb(), 300) display.display_char_fade(chr(0xb0), color_tools.random_rgb(), 300) display.display_char_fade('f', color_tools.random_rgb(), 300) time.sleep(0.4)
def attention(): for loop in range(4): frame = [(0, 0, 0)]*16 for color in [color_tools.random_rgb(), (0, 0, 0)]: for a, b in [(0, 1), (8, 9), (4, 5)]: frame[a] = frame[b] = color fade_frame(frame, 0.2)
def show_text(text, delay, fade, random, color=(0, 0, 0)): for c in text: color = color_tools.random_rgb() if random else color if not fade: show_char(c, color) time.sleep(delay) else: fade_frame(get_char_frame(c, color), delay * 0.75) time.sleep(delay * 0.25)
def get_char_frame(char, (r, g, b)): frame = [(0, 0, 0)]*16 for i in clock_ascii.char_segs(char): frame[i] = (r, g, b) return frame def show_char(char, (r, g, b)): global segments segments = get_char_frame(char, (r, g, b)) push_segs() def show_text(text, delay, fade, random, (r, g, b)=(0, 0, 0)): for c in text: (r, g, b) = color_tools.random_rgb() if random else (r, g, b) if not fade: show_char(c, (r, g, b)) time.sleep(delay) else: fade_frame(get_char_frame(c, (r, g, b)), delay*0.75) time.sleep(delay*0.25) def show_frame(frame): global segments segments = list(frame) push_segs() def attention():