Skip to content

Denis-Source/weather_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weather_app

Simple yet elegant weather application

Features

  • adaptable color scheme to time of the day and weather conditions;
  • ability to select a weather api;
  • selectable temperature units and time formats;
  • simple yet effective location search;
  • location autosetting;
  • written in kivy and tkinter GUI frameworks.

Installation

Weather app uses kivy as a frontend framework and can be installed on both mobile and desktop platforms. Installation process:

git clone https://github.com/Denis-Source/weather_app
cd weather_app

It is recommended to use venv Windows:

python -m venv venv
venv\Scripts\Activate.ps1
pip install -r requirements.txt

Linux/MacOS:

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

In order to use the app you should have API keys. For testing purposes, you can use MetaWeather and Sunset and Sunrise APIs. To run the app simply start the main file:

python weather_app.py

Showcase

Search screen

By default, the app will ask a location to get weather about. The location can be entered in any language supported by the APIs. The search screen can be omitted if the default location setting is set. image

Location is determined by the API and it has a comprehensive list of cities and locations all around the world.

Status screen

When the location is entered, the application makes several calls to the APIs:

  • depending on whether the selected API gets the coordinates or the woeid of the specified location;
  • gets information about sun rise or set timings (needed to determine time of the day of the location);
  • api call to get current weather information;
  • one or several calls to get a forecast for the next 4 or more days.

If the entered city is correct and the API key is correct, the API returns a valid response.

The list of API handlers that parse and decode the information to a standard format, creating a weather object that contains the following information:

  • current temperature;
  • current weather conditions;
  • approximate daily forecast for the next 4 days;
  • other information is stored but not used (wind, humidity, etc).

The main design feature of the application is the ability to change its appearance depending on weather conditions and time of the day.

Cloudy weather in New York at 5 in the evening will have the next theme:

image

Clear weather in LA at 2:

image

Cloudy weather in Lisbon at dusk:

image

Night in Kyiv:

image

Sunrise in Hong Kong:

image


Customization

The application allows you to change time format, temperature units as well as APIs you call. All this work can be done via the configuration screen (menu button or f1 key). The screen theme is also dynamically changed.

Example of the configuration screen:

image

There is an option to define the default location.

The default can be set in the form:

image


APIs

The application has 3 or 4 different types of APIs:

  • geolocation;
  • sunrise and sunset information about the location;
  • current weather information;
  • average forecast for the following 4 or more days.

The architecture of the app allows dynamic selection of APIs on the fly.

Selection of APIs for weather reports:

image

As the latest version is considered, there are the following available APIs:

Some of them require an API key and allow a limited daily requests amount; others are free.

Note: Some APIs use woeid and other longitude and latitude, so as a consequence they, are not compatible.