How it works…
You create an instance of the Client class and name it gmaps. While creating the Client instance, you need to pass the API key that you got on registering with Google. The click() event of the push button with objectName, pushButtonFindDistance, is connected to the displayDistance method. This means that, whenever the push button is clicked, the displayDistance method will be invoked. In the displayDistance method, you invoke the distance_matrix method, passing the Client instance and the two locations entered by the user, to find out the distance between them. The distance_matrix method returns a multidimensional array that is assigned to the data array. From the data array, the distance between the two locations is accessed ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access