def draw_weather_icons(draw, weather_data, left, top, right, bottom): icon_string = weather_data['weather_icon'] icon = string_to_icon(icon_string) icon_font = ImageFont.truetype('./fonts/weathericons-regular-webfont.ttf', 64) draw_cal.centered_text(draw, icon, icon_font, left, top, right, bottom, 0, -12)
def today_weather_info(draw, weather_data, left, top, right, bottom): temp_now = weather_data['temp_now'] precip_type = weather_data['precip_type'] precip_prob = weather_data['precip_prob'] temp_low = weather_data['temp_low'] temp_high = weather_data['temp_high'] weather_string = 'T: {} | {}% {} \nL: {} | H: {}'.format(temp_now, precip_type, precip_prob, temp_low, temp_high) font18 = ImageFont.truetype('./fonts/mononoki-Regular.ttf', 18) draw_cal.centered_text(draw, weather_string, font18, left, top, right, bottom, 6, -10)
def tmrw_weather_info(draw, weather_data, left, top, right, bottom): moonphase = weather_data['moonphase'] moonphase_icon = moonphase_to_icon(moonphase) precip_type = weather_data['precip_type'] precip_prob = weather_data['precip_prob'] temp_low = weather_data['temp_low'] temp_high = weather_data['temp_high'] weather_string = 'M: | {}% {} \n L: {} | H: {}'.format( precip_type, precip_prob, temp_low, temp_high) font18 = ImageFont.truetype('./fonts/mononoki-Regular.ttf', 18) draw_cal.centered_text(draw, weather_string, font18, left, top, right, bottom, 6, -10) #total hack to get the moonphase icon in moon_font = ImageFont.truetype('./fonts/weathericons-regular-webfont.ttf', 18) moon_string = ' {} \n '.format(moonphase_icon) draw_cal.centered_text(draw, moon_string, moon_font, left, top, right, bottom, -12, -10)
def title(draw, today_dt, font, day_view_divider, title_divider): title = today_dt.strftime("%A %B %d, %Y") draw_cal.centered_text(draw, title, font, 0, 0, day_view_divider, title_divider, 0, 0)