Google Map Pin
Join the DZone community and get the full member experience.Join For Free
def pin(x,y,char=None): # top-left is x-5, y-17 points = [ (0,0), (-2,-6), (-5,-10), (-5,-14), (-2,-17), \ (2,-17), (5,-14), (5,-10), (2,-6)] c.polygon([(x+dx,y+dy) for dx,dy in points], 0, (255,119,107), 1) if char: c.text((x-2, y-7), unicode(char)) else: c.point((x,y-12), 0, width=5)Instead of adding a pin image to the program, this function will draw a google map pin at point (x,y) instead. If you give it a char, it will put that char in the middle of the pin as well
pin(20,20,'A') # A in the pin pin(40,40) # just bull-eye
Opinions expressed by DZone contributors are their own.