Oh Snap!

Please turnoff your ad blocking mode for viewing your site content

Hit enter after type your search item

Python 3 Geopy Library Tkinter GUI Geolocation Script to Print Full Address with Country,State and Pincode From City Name Full Project For Beginners

/
/
/
19 Views

 

Welcome folks today in this post we will be printing full address geolocation in tkinter using python. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started we need to install the following library using pip command as shown below

 

pip install geopy

 

After installing this library make an app.py file and copy paste the following code

 

app.py

 

# importing the modules
from geopy.geocoders import Nominatim
from tkinter import *
from tkinter import messagebox 

def getinfo():
    geolocator = Nominatim(user_agent = "geoapiExercises")
    place = e.get()
    place_res.set(place)
    location = geolocator.geocode(place)
    res.set(location)

# object of tkinter
# and background set for light grey
master = Tk()
master.configure(bg = 'light grey')

# variable Classes in tkinter
place_res = StringVar();
res = StringVar();

# creating label for each information
# name using widget Label 
Label(master, text = "Enter place :" ,
    bg = "light grey").grid(row = 0, sticky = W)
Label(master, text = "Place :" ,
    bg = "light grey").grid(row = 1, sticky = W)
Label(master, text = "Country Address :" ,
    bg = "light grey").grid(row = 2, sticky = W)

# creating lebel for class variable
# name using widget Entry
Label(master, text = "", textvariable = place_res,
    bg = "light grey").grid(row = 1, column = 1, sticky = W)
Label(master, text = "", textvariable = res,
    bg = "light grey").grid(row = 2, column = 1, sticky = W)

e = Entry(master)
e.grid(row = 0, column = 1)

# creating a button using the widget 
# Button that will call the submit function 
b = Button(master, text = "Show", command = getinfo )
b.grid(row = 0, column = 2, columnspan = 2,
    rowspan = 2, padx = 5, pady = 5)

mainloop()

 

READ  Python PyQt5 CoronaVirus API Cases, Recovered Cases and Total Deaths Tracker of Different Countries GUI Script Desktop App Full Project For Beginners

Now if you execute the above python script by typing the below command

 

python app.py

 

Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar
Coding Shiksha 2020. All Rights Reserved.
Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views :