The back buffer is undefined after a flip, it may contain the previous frame, the frame before that or random noise depending on the graphics architecture of the particular system. Always use grabpixmap just before flip, which is where I suggest you check for the user keypress.