This is a simple Weather App built with Python and Tkinter that allows users to get real-time weather information for any city by entering the city name. The app fetches data from the OpenWeatherMap API.
- City Weather Lookup: Get weather details like temperature and weather conditions.
- User-Friendly GUI: Built with Tkinter for easy interaction.
- Real-time Weather Data: Fetches weather data from OpenWeatherMap API.
- Python 3.x
- Tkinter (Pre-installed with Python)
- requests library
To install the required libraries, run the following command:
pip install requests-
Get an API Key:
-
Go to OpenWeatherMap and sign up to get an API key.
- After logging in, go to API Keys and generate a new key.
-
Add Your API Key to the Code:
- Replace the placeholder
your_actual_api_key_herewith your generated API key in the code:API_KEY = "your_actual_api_key_here"
- Replace the placeholder
-
Run the Application:
- After setting up the API key, run the following command:
python weather_app.py
- After setting up the API key, run the following command:
-
Enter a City Name:
- Enter the name of a city (e.g., "London") and click on Get Weather to see the weather data.
- The app takes a city name as input.
- It sends a request to the OpenWeatherMap API with the city name and your API key.
- The response contains data about the weather in that city, including temperature and weather description.
- The app displays this information in the GUI.
- City: London
- Temperature: 15°C
- Condition: Clear sky
-
Invalid API Key:
- Ensure the API key is correctly copied from OpenWeatherMap and there are no extra spaces.
-
City Not Found:
- Double-check the spelling of the city.
- Try entering the city with the country code, like "London,GB".
- This project is open-source and available under the MIT License.
- AnupamaUshetti