How to move object smoothly and with time ?

How to move an object in realtime and smoothly on viewport with python ?

I mean as pseudo :

for move in range (0, time(10)):
objmov = getobject
objmov.x += 2
move_time = move

time(10) mean 10 second to move an object in x. What do you think? It is possible to make it?

finally there is other to do it :



import bpy
obj = bpy.context.object
obj.location[2] = 0.0
obj.keyframe_insert(data_path="location", frame=10.0, index=2)
obj.location[2] = 1.0
obj.keyframe_insert(data_path="location", frame=20.0, index=2)

I was thinking if it is possible to make animate cube without keyframe… Anyone ?