Repaint that lets to see the change

Hello !

I am trying to display the movement of a rectangle. I change the coordinate of it, try to repaint(), and wait with Thead::sleep () functions beetween all the change in order to have the time to see the evolution of movement.

However… It seems that the repaint function is too fast? Or
I use a bad method because I can see only the last position I set.
During the time of sleep, no repaint is done, and after the waiting time the last position appears…

Have you an idea in order to display the change visible for a humain…?

I saw that repaint() function does not repaint immediatly but just say that draw is"dirty" and need to be repaint… So how to do to repaint immediatly?

I continue to search…

You don’t repaint immediately. The whole point of event-driven programming is that you don’t block the message thread, you use callbacks, timers, etc instead.

Thanks you, Timer method is okay !