Skip to content

this is a simple weather app made with a api and python framework flet

Notifications You must be signed in to change notification settings

Abdulraheem232/Weatherapp-Flet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here's a README file for your Weather app built using Flet:


Weather App with 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.

Features

  • 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.

Tech Stack

  • 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.

Installation

Prerequisites

Ensure you have Python 3.8+ installed. You can check your Python version by running:

python --version

Setting up the Project

  1. Clone the repository to your local machine:

    git clone https://github.com/Abdulraheem232/Weatherapp-Flet.git
    cd weather-app-flet
  2. Install the required dependencies:

    pip install requests flet
  3. Run the application:

    python app.py

    The application will be accessible in your browser at http://localhost:8550.

Code Overview

main(page: Page)

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.

getweather(e)

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.

UI Elements

  • 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.

Weather Descriptions and Icons

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

Future Enhancements

  • 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.

License

This project is open-source and available under the MIT License.


About

this is a simple weather app made with a api and python framework flet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages