From b9b4fd6ddce78009dcc9d17c983485c30858d136 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 10 Feb 2021 14:03:12 +0700 Subject: [PATCH] better rounded output for forecast on left click --- weather_applet/weather.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weather_applet/weather.py b/weather_applet/weather.py index 078c4f1..e019f67 100755 --- a/weather_applet/weather.py +++ b/weather_applet/weather.py @@ -84,14 +84,14 @@ def get_forecast(api_key, lat, lon, unit): for i in json['daily'][1:4]: timestamp = i['dt'] date_clean = datetime.fromtimestamp(timestamp).strftime("%a %Y-%m-%d") - min_temp = i['temp']['min'] - max_temp = i['temp']['max'] + min_temp = round(i['temp']['min']) + max_temp = round(i['temp']['max']) weather = i['weather'][0]['main'] weather_desc = i['weather'][0]['description'] icon_id = i['weather'][0]['icon'] icon = iconlist.get(icon_id) first_line = f'{date_clean} {icon} {weather}' - second_line = f'min: {min_temp} max: {max_temp}, {weather_desc}\n' + second_line = f'{min_temp}° - {max_temp}°, {weather_desc}\n' notify_list.append(first_line) notify_list.append(second_line) # output with notify-send