Question: You are going to make a Graphical User Interface for the GeoPoint class you made in previous programs. 1 . The GUI should have a
You are going to make a Graphical User Interface for the GeoPoint class you made in previous programs.
The GUI should have a text box where the user can enter the name of a file that contains a list of points and descriptions.
The GUI should have three more textboxes where the user can enter their own coordinates and description.
There should be a label for each textbox to let the user know what should be entered into those textboxes.
The GUI should have a button the user can click.
When the user clicks the button, the program should create a point representing the user's location from coordinates and description in the textboxes, read the points from the file used in program and finally display a message in another textbox Label that says something like:You are closest to description which is located at point sx y coordirates
You can reuse program as a library. The GeoPoint class should be fine as is
You can take the functionality in the main part of the program and place it in the Button click event handler and modify it as needed.
Alternatively you can modify the functionality in the main part of the program and turn it into functions in your library that you will call from the Button click event handler in your GUI.
Program :
import math
class GeoPoint:
def initself lat lon descriptionTBD:
self.lat lat
self.lon lon
self.description description
def GetPointself:
return self.lat, self.lon
def SetPointself point:
self.lat, self.lon point
def GetDescriptionself:
return self.description
def SetDescriptionself description:
self.description description
def calcDistanceself point:
lat math.radiansselflat
lon math.radians selflon
lat math.radians pointlat
lon math.radians pointlon
dlon lon lon
dlat lat lat
a math.sindlat math.coslat math.coslat math.sindlon
c math.atanmathsqrta math. sqrt a
distancekm R c
return distancekm
def header:
print Distance Calulator
print C
print
def get location:
latitude floatinputEnter latitudein decimal degrees:
longitude float input Enter longitudein decimal degrees:
return latitude: latitude, "longitude": longitude
def displaydistanceDistance:
printInThe distance is f km Distance
def doanother:
usrresponse input
Do another yn
another usrresponse.striplowery
print
return another
def display goodbye:
printThank you forDistance Calulator
Please come again!
def main:
header
while True:
point GeoPoint
point GeoPoint
pointpoint
point description Loc
lat, lon get location
pointuser GeoPointlat lon, 'User Location
distance toone pointcalcDistancepointuser
distance totwo pointcalcDistancepointuser
if distancetoone distanceto two:
closestpoint point
else:
closestpoint point
displaydistanceclosestpoint.calcDistancepoint user
printYou are closest to which is located at formatclosestpoint.GetDescription closestpoint.GetPoint
if not doanother:
break
print Goodbye
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
