automation - Python automate key press of a QtGUI -
i have python script section below:
for index in range(1,10): os.system('./test') os.system('xdotool key return') what want run executable ./test, brings qtgui. in gui, key press prompt buton comes up. want automate key press of gui executable continues.
my python script though runs executable, gui prompt comes , key press not entered until after executable. there way fix this?
os.system doesn't return until child process exits. need subprocess.popen. it's idea sleep while before sending keystrokes (it may take time child process ready accept user input):
from subprocess import popen time import sleep index in range(1,10): # start child process = popen('./test') # sleep allow child draw buttons sleep(.333) # send keystroke os.system('xdotool key return') # wait till child exits process.wait() i'm not shure need last line. if 9 child processes supposed stay alive -- remove it.
Comments
Post a Comment