Here's a README file for your Weather app built using Flet:
This is a simple weather application built using the Flet framework and OpenWeather API. The app allows users to search for weather information by entering a city name and displays the current temperature, humidity, weather condition, and an associated weather image.
- City Search: Enter the name of a city to get the current weather data.
- Weather Information: Displays temperature, humidity, and weather condition for the selected city.
- Weather Icons: Based on the weather condition (e.g., mist, rain, snow), different weather images are shown.
- Simple UI: The app provides a clean and user-friendly interface for viewing weather data.
- Flet Framework: A Python framework for building interactive UIs.
- OpenWeather API: API used to fetch real-time weather data.
- Python: Programming language used to develop the app.
Ensure you have Python 3.8+ installed. You can check your Python version by running:
python --version
-
Clone the repository to your local machine:
git clone https://github.com/Abdulraheem232/Weatherapp-Flet.git cd weather-app-flet
-
Install the required dependencies:
pip install requests flet
-
Run the application:
python app.py
The application will be accessible in your browser at
http://localhost:8550
.
This function sets up the app, including the layout and functionality. It defines how weather information is fetched and displayed when the user enters a city name.
This function is called when the user clicks the "Enter" button. It sends a request to the OpenWeather API to fetch weather data for the entered city. It then updates the UI with the city name, temperature, humidity, and weather condition. Based on the weather description, it displays a relevant weather image.
- TextField (
cityname
): A text input field where users can enter the name of the city. - Button (
getweatherbtn
): A button that triggers the weather data fetching when clicked. - Text Widgets: Display the city name, temperature, humidity, and weather condition.
- Image (
weatherimage
): Displays the appropriate weather image based on the fetched weather description.
The app changes the weather image based on the weather description:
- Mist:
mist.png
- Rain:
rain.png
- Snow:
snow.png
- Wind:
wind.png
- Clear Sky:
clear.png
- Overcast Clouds:
clouds.png
- Drizzle:
drizzle.png
- Error Handling: Improve error handling for cases where the city is not found or the API request fails.
- Forecasting: Add support for multi-day weather forecasting.
- Geolocation: Implement a feature to get weather data for the user's current location.
- Styling: Enhance the styling and UI/UX for a better user experience.
This project is open-source and available under the MIT License.