A simple desktop weather application built with Python and Tkinter that displays current weather and 4-day forecast for any city.
- Current Weather: Displays today's temperature, weather description, and icon
- 4-Day Forecast: Shows daily minimum/maximum temperatures with weather icons
- City Search: Enter any city name to get weather information
- User-Friendly GUI: Clean and intuitive interface using Tkinter
- Python 3.6+
- Required packages (automatically installed via requirements.txt):
requestspython-dotenvtkinter(usually included with Python)
-
Clone the repository:
git clone <repository-url> cd weather-app
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Copy
.env.exampleto.env - Get your OpenWeatherMap API key from OpenWeatherMap
- Add your API key to
.envfile:OPENWEATHER_API_KEY=your_api_key_here
- Copy
-
Run the application:
python main.py
- Launch the application by running
python main.py - Enter a city name in the text field (default is "Belgrade")
- Click "Get Weather" to fetch and display weather information
- View current weather and 4-day forecast with icons
weather-app/
├── main.py # Application entry point
├── requirements.txt # Python dependencies
├── .env.example # Environment variables template
├── .env # Environment variables (not committed)
├── src/
│ ├── api.py # Weather API integration
│ └── gui.py # GUI implementation
├── assets/
│ └── icons/ # Weather icons
├── example.json # Sample API response
├── .gitignore # Git ignore rules
└── README.md # This file
Important: The application uses OpenWeatherMap API. The free tier allows 1000 calls per day.
Security Note: Never commit your .env file to version control. It's already included in .gitignore.
The application uses the following environment variable:
OPENWEATHER_API_KEY: Your OpenWeatherMap API key
Weather icons are stored in the assets/icons/ directory. The application expects PNG files named after OpenWeatherMap icon codes (e.g., 01d.png, 02n.png, etc.). Icons can be downloaded from Dovora Weather Icons or other free weather icon sets.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Weather data provided by OpenWeather
- Weather icons provided by Dovora (Free for commercial use with attribution)
This project is open source and available under the MIT License.
This application is for educational purposes. Weather data is provided by OpenWeatherMap and may not be 100% accurate. Always check official weather sources for critical decisions.