我正在使用tk库来开发GUI。按下按钮后,执行以下功能
def playvid(self,x):
if x == 1:
cmd = 'gst-launch-1.0 videotestsrc ! autovideosink'
elif x == 2:
cmd = 'gst-launch -e videomixer name=mix ! ffmpegcolorspace ! autovideosink videotestsrc pattern=1 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! videobox border-alpha=0 top=0 left=0 ! mix. videotestsrc pattern=15 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! videobox border-alpha=0 top=0 left=-320 ! mix.'
else:
cmd = ''
self.a = 0
self.proc1 = subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True)
print self.proc1.pid
self.cmd = "kill -9 " + str(self.proc1.pid + 2)
with Input(keynames='curses') as input_generator:
for e in input_generator:
if e == 's':
os.system(self.cmd)
return
这会将控制转移到子进程,并且只有在子进程被终止后才会执行GUI上的任何按钮单击。即使在创建子进程后,如何继续使用GUI?