How to quit a Windows GUI program gracefully with Python under Cygwin?

KB kbchung at hongik.ac.kr
Fri Aug 12 12:07:02 CEST 2005


Thanks.

After I confirmed 'Alt-F4' would terminate and close a win32
application running independently,
I installed 'SendKeys' module and tested with the following code under
both Cygwin and Python Windows

import os, SendKeys
os.system('program datafile')
SendKeys.SendKeys("""
    {PAUSE 0.25}
    %{F4}
""")

What happened was that the 'program' ran correctly, but it stayed, not
closing the window
under Cygwin and Python Windows.  So it seems to me that this does not
work.

One more thing: How do I control the pause time if I do not know the
execution
time of an application?

Thanks in advance.

KB




More information about the Python-list mailing list