check the event loop everytime paint is called.