<p>I have drawn an image in the device context using python and I want to move it smoothly/animate either vertically or horizontally.</p>

<p>What algorithm should I use? Where can I get info for this kind of tasks in python?</p>

Once an object is drawn in a device context it stays there. If you want to move it you need to redraw it.
You can keep a background that's fixed and only redraw the movable elements each time they move. Basically that's how it's done.
To move an object smoothly over a line you have to do something like this (I don't have a program ready, so can only give you an idea):
choose the start and end position: point A(x1, y1) and B(x2, y2)
choose in how much time the object should change position from A to B (say 10 seconds).
use a timer set to a certain interval (say 2 seconds)
calculate the delta X and Y that the object should change for each timer interval. In this case dx = (x2-x1)*2/10 and dy = (y2-y1)*2/10
in the timer callback increment the current object position with dx and dy and redraw the image
That would be the algorithm.
I suggest that you also take a look to
PyGame
. Maybe you can use that and it also has some tutorials.