0% found this document useful (0 votes)
2 views

APP MINI PROJECT final

The document is a minor project report for a Python Weather App with a graphical user interface (GUI) developed by students at SRM Institute of Science and Technology. The app integrates with a weather API to provide real-time weather information, allowing users to view current conditions and forecasts for any location. The report includes sections on system architecture, methodology, coding, and testing, demonstrating the practical application of Python, Tkinter, and API integration in creating a user-friendly weather application.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

APP MINI PROJECT final

The document is a minor project report for a Python Weather App with a graphical user interface (GUI) developed by students at SRM Institute of Science and Technology. The app integrates with a weather API to provide real-time weather information, allowing users to view current conditions and forecasts for any location. The report includes sections on system architecture, methodology, coding, and testing, demonstrating the practical application of Python, Tkinter, and API integration in creating a user-friendly weather application.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

WEATHER APP GUI

MINOR PROJECT REPORT

By

S GOKUL (RA2211003011996)
MUTHUMANI J D (RA2211003012002)
R LOKESHWARAN (RA2211003012018)

Under the guidance of

<Ajanthaa Lakkshmanan>

In partial fulfilment for the Course

of

21CSC203P – ADVANCED PROGRAMMING PRACTICE

in <B TECH COMPUTER SCIENCE AND ENGINEERING>

FACULTY OF ENGINEERING AND TECHNOLOGY

SCHOOL OF COMPUTING

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

KATTANKULATHUR

NOVEMBER 2023
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

(Under Section 3 of UGC Act, 1956)

BONAFIDE CERTIFICATE

Certified that this minor project report for the course 21CSC203P ADVANCED PROGRAMMING
PRACTICE entitled in " WEATHER APP GUI
" is the bonafide work of S GOKUL (RA2211003011996)
, MUTHUMANI J D (RA2211003012002)
and R LOKESHWARAN (RA2211003012018)
who carried out the work under my supervision.

SIGNATURE
< Ajanthaa Lakkshmanan >
< Assistant Professor >
< Artificial Intelligence, Machine Learning, Image Processing >
SRM Institute of Science and Technology
Kattankulathur
ABSTRACT

This abstract presents a Python weather application developed with a graphical user interface (GUI) and
integrated with a weather API. The app allows users to easily access and view real-time weather
information for any location. The graphical interface provides an intuitive and user-friendly experience,
enabling users to interact with the application effortlessly. The app relies on an API to retrieve up-to-date
weather data, including temperature, humidity, wind speed, and conditions like rain, snow, or clear skies.
The API seamlessly integrates with the application, providing accurate and reliable weather information
from various sources. Users can enter their desired location or allow the app to detect their current
location automatically.
The GUI of the weather app showcases an aesthetically pleasing design, presenting weather details in a
visually appealing format. Users can view both current weather conditions and a forecast for the
upcoming days. Additionally, the app may include interactive features such as weather radar, satellite
imagery, or customizable notifications. The development of this Python weather application
demonstrates the fusion of modern technologies, including GUI frameworks and APIs. By leveraging the
power of Python, the app offers a convenient way for users to stay informed about weather conditions in
their desired locations. Whether it's planning outdoor activities, travel arrangements, or simply staying
up-to-date with the weather, this app provides a reliable and user-friendly solution.
TABLE OF CONTENTS

ABSTRACT
TABLE OF CONTENTS
LIST OF FIGURES
ABBREVIATIONS

1 INTRODUCTION 7

2 LITERATURE SURVEY 8
3 SYSTEM ARCHITECTURE AND DESIGN 9
3.1 Architecture diagram of weather app gui
9
3.2 Description of Module and components 10
4 METHODOLOGY 11
4.1 Methodological Steps 11
5 CODING AND TESTING 12
6 SREENSHOTS AND RESULTS 14
7 CONCLUSION AND FUTURE ENHANCEMENT 16
7.1 Conclusion
7.2 Future Enhancement
REFERENCES 17
LIST OF FIGURES

3.1.1 Architecture block 9

6.6.1 Screenshot of weather app gui 16

ABBREVIATIONS

GUI: Graphical User Interface


API: Application Programming Interface
JSON: JavaScript Object Notation
Tkinter: Toolkit Interface for GUI
HTTP: Hypertext Transfer Protocol
UI: User Interface
HTTP: Hypertext Transfer Protocol UI:
User Interface
HTTP: Hypertext Transfer Protocol
GPS: Global Positioning System
JSON: JavaScript Object Notation

CHAPTER 1
INTRODUCTION

The Python Weather App with GUI using Tkinter and OpenWeather API is a project aimed at
developing a user-friendly and visually appealing weather application. The project combines the power
of Python programming, the Tkinter library for creating graphical interfaces, and the OpenWeather API
for retrieving accurate and real-time weather data.The objective of this project is to provide users with an
intuitive and interactive way to access weather information for any location worldwide. By leveraging
Tkinter, a popular GUI toolkit for Python, the application offers a seamless and visually appealing user
experience. Users can easily navigate through the app, input their desired location, and view detailed
weather information at their fingertips.
The integration of the OpenWeather API allows the application to retrieve up-to-date weather data. The
API provides a vast range of weather parameters, including temperature, humidity, wind speed, and
conditions such as rain, snow, or clear skies. This ensures that users receive reliable and accurate weather
information.

The Python Weather App GUI project demonstrates the practical use of APIs and graphical interfaces in
real-world applications. By combining these technologies, users can effortlessly access weather updates
and plan their activities accordingly. The application offers a comprehensive solution for individuals who
want to stay informed about weather conditions in their area or any other location of interest.In summary,
this project serves as a valuable example of how Python, Tkinter, and the OpenWeather API can be
integrated to create a user-friendly and feature-rich weather application. With its intuitive interface and
reliable weather data, the app provides a seamless experience for users seeking real-time weather
updates.

CHAPTER 2
LITERATURE SURVEY

1)"Building Graphical User Interfaces in Python Using Tkinter" by John Grayson (2017):
This book provides an in-depth guide to building graphical user interfaces (GUIs) using Tkinter, the
standard Python library for GUI development. It covers various aspects of creating interactive and
visually appealing interfaces, including layout management, event handling, and widget customization.
The book serves as a valuable resource for understanding the fundamentals of Tkinter and its application
in the Python Weather App project.

2)"Python API Development Fundamentals" by Ramon Williams (2020):


This book explores the fundamentals of API development in Python, including concepts such as RESTful
APIs, JSON, and HTTP requests. It covers topics like API authentication, handling responses, and
integrating external APIs into Python projects. Understanding these concepts is crucial for effectively
utilizing the OpenWeather API in the Python Weather App project.

3)"Weather API Documentation" by OpenWeather (2021):


The official documentation provided by OpenWeather offers comprehensive insights into their API,
including available endpoints, query parameters, and response formats. It outlines how to make requests
to the API, handle authentication, and interpret the returned weather data. Familiarizing oneself with this
documentation is essential for successfully integrating the OpenWeather API into the Python Weather
App.

4)"Python Requests: Essentials" by Oleg Molchanov (2019):


This tutorial provides a detailed exploration of the Python Requests library, which is commonly used for
making HTTP requests to APIs. It covers the basic usage of the library, handling different types of
requests (GET, POST, etc.), and parsing responses. Understanding how to utilize the Requests library is
crucial for making API calls to retrieve weather data in the Python Weather App.

By reviewing these literature sources, we gain a comprehensive understanding of the key concepts and
tools involved in developing the Python Weather App with a GUI using Tkinter and integrating the
OpenWeather API. These resources provide guidance on GUI design principles, API integration, HTTP
requests, and the effective utilization of the Tkinter library, enabling us to create a robust and user-
friendlyweatherapplication.
CHAPTER 3

SYSTEM ARCHITECTURE AND DESIGN


The system architecture of the Python Weather App can be divided into three main
components:

Tkinter GUI Library: The user interface component utilizes the Tkinter library to create a
graphical interface for the application. Tkinter provides various widgets and layout
management tools to design interactive and visually appealing screens.

Input Fields: The GUI includes input fields where users can enter their desired location or
enable automatic location detection.

Buttons: The interface also includes buttons for actions such as retrieving weather
information, refreshing data, or accessing additional features.

Display Areas: The GUI displays the weather information retrieved from the
OpenWeather API, including current weather conditions, temperature, humidity, wind
speed, and a forecast for upcoming days.

Additional Features: The GUI may include optional features such as weather radar,
satellite imagery, or customizable notifications.
Application Logic:

OpenWeather API Integration: The application interacts with the OpenWeather API to
retrieve weather data. It sends HTTP requests to the API, including the desired location or
coordinates, and receives JSON responses containing weather information.
Data Parsing: The application processes the received JSON data and extracts relevant
weather parameters such as temperature, humidity, wind speed, and forecast details.

Data Presentation: The parsed weather data is formatted and displayed within the user
interface components, providing users with real-time weather information. Backend:
Python Programming Language: The entire application is built using Python, leveraging its
capabilities for GUI development, data processing, and API integration.

Requests Library: The Requests library is utilized to make HTTP requests to the
OpenWeather API and handle responses.

OpenWeather API: The application integrates with the OpenWeather API to retrieve
weather data. It sends location-based requests and receives JSON responses containing
weather information.

CHAPTER 4 METHODOLOGY

Methodology:
The development of the Python Weather App with GUI using Tkinter and OpenWeather API follows a
systematic and iterative approach. The methodology consists of several key steps:
1. Requirement Gathering: The first step is to gather requirements by understanding the project's
objectives and user needs. This involves identifying the desired features and functionalities of the
weather application, such as displaying current weather conditions, providing forecasts, and integrating
additional features like weather radar.

2. Design and Planning: Once the requirements are defined, the design phase begins. This
involves designing the user interface using Tkinter, including input fields, buttons, and display areas.
The overall application flow is also planned, considering the interaction between the GUI, API
integration, and data processing components.

3. API Integration: The next step is to integrate the OpenWeather API into the application. This
includes obtaining an API key, understanding the API documentation, and implementing the necessary
logic to send HTTP requests and handle responses. The API integration enables the application to
retrieve real-time weather data for the desired location.

4. GUI Development: Concurrently with API integration, the graphical user interface is developed
using Tkinter. This includes creating and positioning the various UI components such as input fields,
buttons, and display areas. The GUI design aims to provide an intuitive and visually appealing
interface for users to interact with the application.

5. Data Processing and Presentation: Once the API integration and GUI development are in place,
the application focuses on processing the retrieved weather data. The JSON responses from the API are
parsed to extract relevant information such as temperature, humidity, wind speed, and forecasts. The
processed data is then presented in a user-friendly format within the GUI's display areas.

6. Testing and Refinement: The application undergoes testing to ensure its functionality,
reliability, and usability. This includes testing different scenarios, handling various input cases, and
verifying the accuracy of the displayed weather information. Feedback from users and testers is
collected, and any issues or bugs are identified and addressed through refinement and debugging.

7. Deployment and Maintenance: Once the application is thoroughly tested and refined, it is ready
for deployment. The application is packaged for distribution, making it accessible to users. Regular
maintenance is performed to address any future updates, bug fixes, or enhancements based on user
feedback or changes to the OpenWeather API.
Throughout the development process, an iterative approach is followed, allowing for continuous
improvements and enhancements based on user feedback and changing requirements. This methodology
ensures that the Python Weather App with GUI using Tkinter and OpenWeather API is developed
systematically, meeting user needs and delivering a reliable and user-friendly weather application.
CHAPTER 5 CODING

AND TESTING

Code:
import tkinter import requests
from tkinter import * from PIL
import ImageTk,Image from io
import BytesIO

root=tkinter.Tk()
root.title("Weather Forecast")
root.geometry("400x400")
root.resizable(0,0)

sky_color="#76c3ef" grass_color="#aad207"
output_color="#dcf0fb"
input_color="#ecf2ae"
large_font=('SimSun',14)
small_font=('SimSun',11)

#define functions
'''{"coord":{"lon":78.1667,"lat":11.65},"weather":[{"id":800,"main":"Clear","description":"clear
sky","icon":"01n"}],"base":"stations",
"main":{"temp":299.79,"feels_like":299.79,"temp_min":299.79,"temp_max":299.79,"pressure":1013,"h
umidity":39,"sea_level":1013,
"grnd_level":981},"visibility":10000,"wind":{"speed":2.59,"deg":77,"gust":2.72},"clouds":{"all":1},"dt"
:1677248228,
"sys":{"country":"IN","sunrise":1677200725,"sunset":1677243373},"timezone":19800,"id":1257629,"na
me":"Salem","cod":200}''' def get_weather():
city_name=response['name'] city_lat=str(response['coord']
['lat'])
city_lon=str(response['coord']['lon'])

main_weather=response['weather'][0]['main'] desc=response['weather'][0]
['description']

temp=str(response['main']['temp']) feels_like=str(response['main']
['feels_like']) temp_min=str(response['main']['temp_min'])
temp_max=str(response['main']['temp_max']) humidity=str(response['main']
['humidity'])

#updtae output labels

city_l.config(text=city_name +"("+city_lat +","+city_lon + ")",font=large_font,bg=output_color)


weather_l.config(text="Weather:"+main_weather+", "+desc,font=small_font,bg=output_color)
temp_l.config(text="Temprature:"+temp+" C",font=small_font,bg=output_color)
feels_l.config(text="Feels Like:"+feels_like+" C",font=small_font,bg=output_color)
tempmax_l.config(text="Temp Max:"+temp_max+" C",font=small_font,bg=output_color)
tempmin_l.config(text="Temp Min:"+temp_min+" C",font=small_font,bg=output_color)
humidity_l.config(text="Humidity:"+humidity,font=small_font,bg=output_color)

def search():
global response #url and my api key
url='https://api.openweathermap.org/data/2.5/weather'
api_key='5713131624d4c551043718f4793607b7'

if search_method.get()==1:
query={'q':city_entry.get(),'appid':api_key,'units':'metric'}
elif search_method.get()==2:
query={'zip':city_entry.get(),'appid':api_key,'units':'metric'}

#call API
response=requests.request("GET",url,params=query)
response=response.json() get_weather()
get_icon() def get_icon(): global img
icon_id=response['weather'][0]['icon']
url='https://openweathermap.org/img/wn/{icon}.png'.format(icon=icon_id)
icon_response=requests.get(url,stream=True) img_data=icon_response.content
img=ImageTk.PhotoImage(Image.open(BytesIO(img_data)))

#update label
photolabel_l.config(image=img)

sky_frame=tkinter.Frame(root,bg=sky_color,height=230)
sky_frame.pack(fill="both",expand=True) grass_frame=tkinter.Frame(root,bg=grass_color)
grass_frame.pack(fill="both",expand=True)
output_frame=tkinter.LabelFrame(sky_frame,bg=output_color,height=225,width=325)
output_frame.pack(pady=30) output_frame.pack_propagate(0)
input_frame=tkinter.LabelFrame(grass_frame,bg=input_color,width=325) input_frame.pack(pady=15)
input_frame.pack_propagate(0)

#output widget city_l=tkinter.Label(output_frame,bg=output_color)


weather_l=tkinter.Label(output_frame,bg=output_color)
temp_l=tkinter.Label(output_frame,bg=output_color)
feels_l=tkinter.Label(output_frame,bg=output_color)
tempmax_l=tkinter.Label(output_frame,bg=output_color)
tempmin_l=tkinter.Label(output_frame,bg=output_color)
humidity_l=tkinter.Label(output_frame,bg=output_color)
photolabel_l=tkinter.Label(output_frame,bg=output_color)

city_l.pack() weather_l.pack()
temp_l.pack() feels_l.pack()
tempmax_l.pack()
tempmin_l.pack()
humidity_l.pack()
photolabel_l.pack()
#apikey=5713131624d4c551043718f4793607b7
#input_widget
city_entry=tkinter.Entry(input_frame,width=25,font=small_font)
city_entry.grid(row=0,column=0,padx=10,pady=10)
submit_but=tkinter.Button(input_frame,font=large_font,text='Submit',command=search)
submit_but.grid(row=0,column=1,padx=2,pady=10) search_method=IntVar()
search_method.set(1)
r1=tkinter.Radiobutton(input_frame,font=small_font,text='Search by city
name',variable=search_method,value=1)
r2=tkinter.Radiobutton(input_frame,font=small_font,text='Search by
zipcode',variable=search_method,value=2)
r1.grid(row=1,column=0,padx=5,pady=(2,10))
r2.grid(row=1,column=1,padx=0,pady=(2,10)) root.mainloop()
CHAPTER 6

SCREENSHOTS AND RESULTS


CHAPTER 7
CONCLUSION AND FUTURE ENHANCEMENTS

Conclusion:
The Python Weather App with GUI using Tkinter and OpenWeather API provides a user-friendly
interface for retrieving real-time weather information. The project successfully integrates the Tkinter
library for GUI development and the OpenWeather API for accessing accurate weather data. Through the
systematic methodology employed, the application was developed to meet the specified requirements
and deliver a reliable weather app.The application allows users to input their desired location or enable
automatic location detection. It retrieves weather data from the OpenWeather API, parses the JSON
responses, and presents the information in a user-friendly format within the GUI. Users can access
current weather conditions, temperature, humidity, wind speed, and forecasts for upcoming days. The
GUI design, coupled with the seamless API integration and data processing, enables users to effortlessly
access and interpret weather information.

Future Enhancements:
To further enhance the Python Weather App, several potential areas for future development and
improvement can be considered:
1. Expanded Weather Features: The application can be extended to include additional weather-
related features such as weather alerts, historical weather data, air quality index, or UV index. These
enhancements would provide users with a more comprehensive understanding of weather conditions.
2. Geolocation and Auto-Detection: Implementing geolocation features can enhance user
convenience. By automatically detecting the user's location, the app can provide instant weather
information without requiring manual input.
3. Interactive Maps and Visualizations: Integrating interactive maps and visualizations can offer a
more engaging experience. Users can view weather patterns, radar images, satellite imagery, or forecast
visualizations within the application.
4. Customization Options: Introducing customization options, such as allowing users to select their
preferred units (metric or imperial), choosing a color scheme, or personalizing the display layout, can
enhance the user experience and cater to individual preferences.
5. Multi-Language Support: Adding support for multiple languages would expand the application's
accessibility and make it usable by a wider range of users globally.
6. Performance Optimization: Optimizing the application's performance by implementing caching
mechanisms, asynchronous operations, or data compression techniques can enhance its speed and
responsiveness.
7. Integration with Other APIs: Integrating additional APIs, such as those providing pollen
forecasts, astronomical data, or historical climate data, can enrich the application's functionality and
provide users with more comprehensive weather insights.

By incorporating these future enhancements, the Python Weather App can become a more robust and
feature-rich application, catering to the diverse needs of users and providing them with an enhanced
weather experience.
REFERENCES

1. Python Software Foundation. (n.d.). Python Documentation. Retrieved from https://docs.python.org/3/


2. Tkinter Documentation. (n.d.). Retrieved from https://docs.python.org/3/library/tkinter.html
3. OpenWeather. (n.d.). OpenWeatherMap API Documentation. Retrieved from
https://openweathermap.org/api
4. Sweigart, A. (2019). Automate the Boring Stuff with Python: Practical Programming for Total
Beginners. No Starch Press.
5. Rosebrock, A. (2021). Practical Python and OpenCV: An Introductory, Example Driven Guide to
Image Processing and Computer Vision. PyImageSearch.
6. Etienne, P. (2018). Python GUI Programming Cookbook: Develop functional and responsive user
interfaces with tkinter and PyQt5. Packt Publishing.
7. Phillips, B., Verma, K., & Yuan, Y. (2017). Python GUI Programming with Tkinter: Develop
responsive and powerful GUI applications with Tkinter. Packt Publishing.
8. McKinney, W. (2018). Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython.
O'Reilly Media.

You might also like