Correct way to update a vtkImageData and refresh the render window (renderWindow.Render() not working)

You are most likely blocking the event loop in the GUI by calling sleep(). What happens in the second call to main() if the sleep time is again set to 0.01?

Try making the update() method asynchronous.