user1027046 user1027046 - 2 months ago 10
Python Question

how to pause a program until a button is pressed

I am using py2exe to make executable.
I want to know how to pause the program until a button is pressed.. just like we do in C using

system("pause");


As the program terminates automatically in windows, I need this tool.

Is there anything better than py2exe which does similar work ?

Answer

You can use raw_input in Python2, or input in Python 3

raw_input("Press Enter to terminate.")