You make a "grid", but don't show it. There are many way of accomplishing this. I think the easiest way to do this is, every time someone places a piece, just snap it to the closest co-ordinates, that is a multiple of the size of each piece.
E.G.
width = 20 # This is the width of each piece
height = 20 # This is the height of each piece
x = 44 # This is the x co-ordinate of where the piece was placed
y = 71 # This is the y co-ordinate of where the piece was placed
def new_round(value, multiple):
# Some dirty math to round "value" to the closest multiple of "multiple"
return int(round(value / float(multiple)) * multiple)
newx = new_round(x, width) # Round x to the closest width
newy = new_round(y, height) # Round y to the closest height
By the way, just curious. How are you displaying the images? Pygame? WxPython?