adds repaint() method on keypress event