There's not enough information to really work out what you are trying to do or what is happening.

Basically you need to do some debugging yourself. Add some print statements to output the state of the variables and the co-ordinates you are drawing and you should be able to work out where it is going wrong.