Search icon CANCEL
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi Projects for Kids

You're reading from  Raspberry Pi Projects for Kids

Product type Book
Published in Mar 2014
Publisher
ISBN-13 9781783982226
Pages 96 pages
Edition 1st Edition
Languages
Author (1):
Daniel Leonard Bates Daniel Leonard Bates
Profile icon Daniel Leonard Bates

Code listing


Here is the complete code for the project in this chapter. It can be used if you're getting strange error messages and want to compare your code with something that is known to work. It can also help you see which order the various snippets of code should be in.

The very first thing in the file should be the import statements. It's a good idea to put these in alphabetical order so we can search through them more quickly when we import a lot of modules; this is shown in the following code snippet:

import base64
import Tkinter

import urllib

Next, we have two functions that work together. The first one creates a web address and the second downloads the map image from that address as shown in the following code snippet:

def getaddress(location, width, height, zoom):
    locationnospaces = urllib.quote_plus(location)
    address = "http://maps.googleapis.com/maps/api/staticmap?\
center={0}&zoom={1}&size={2}x{3}&format=gif&sensor=false"\
.format(locationnospaces, zoom...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}