1

開始する新しいスレッドに control-c を送信できる必要があります。これについてどうすればよいでしょうか。スレッドを開始できますが、control-c を使用してコマンド ラインで行うように停止する必要があります。

from Tkinter import *
import threading # should use the threading module instead!
import Queue
import os


def show1():
    os.system('ola_recorder -p MyRecord -i 0')

def show2 ():
    os.system('ola_recorder -p MyRecord ')

def stop ():
    os.system('^c')


t = threading.Thread(name='Show2', target=show2)

root = Tk()
b = Button(root, text="Show 1", command=lambda: thread.start_new(show1, ()))
b.pack()

b2 = Button(root, text="Show 2", command=lambda: t.start())
b2.pack()

root.mainloop()
4

1 に答える 1