How Do You Interrupt A Loop From A Keyboard Input?

I have a loop in Python driving a MEL progressWindow, and I'd like the user to be able to interrupt the loop by pressing the escape key (I'm on Windows XP). How can I do that?

In your loop you have to check to see if the window has been canceled, and if it is then break out of the loop. Here's the example from the maya py docs:

CODE
if cmds.progressWindow( query=True, isCancelled=True ):
    break