This is a simple weather forecast application built using Python and the Tkinter library. It allows the user to input the name of a city or a zip code and then retrieves the current weather information for that location from the OpenWeatherMap API.
- Ensure you have Python installed on your system.
- Clone or download this repository to your local machine.
- Obtain an API key from OpenWeatherMap by signing up for a free account.
- Open the Python script (weather_forecast.py) in a text editor or an Integrated Development Environment (IDE) of your choice.
- Replace the api_key variable with your actual API key obtained from OpenWeatherMap in the get_weather_data() function.
- Save the changes to the Python script.
This application requires the following Python libraries:
- tkinter: Used for creating the graphical user interface (GUI).
- requests: Used to make HTTP requests to the OpenWeatherMap API and retrieve weather data.
You can install the required libraries using pip: pip install requests
To run the weather forecast application, follow these steps:
- Open a terminal or command prompt.
- Navigate to the directory where the weather_forecast.py script is located.
- Execute the following command: python weather_forecast.py
- The GUI window will appear with an input field and a "Get Weather" button.
- Enter the name of a city or a zip code in the input field and click the "Get Weather" button.
- If the weather data is available for the specified location, a pop-up window will display the following information:
- City name
- Temperature in Celsius
- Humidity percentage
- Wind speed in meters per second
- Weather description
- If the weather data is not available or if there is an error in retrieving the data, an error message will be displayed in a pop-up window.
I want you to know that contributions to this project are welcome. Feel free to submit a pull request if you find any issues or want to improve the application.
This weather forecast application is open-source and distributed under the MIT License. You can freely use and modify the code according to the terms of the license.