サブプロセスが終了するのを待たずにサブプロセスが終了するタイミングを知るTkinter GUIがあります。まだ完全に対話可能/フリーズしていません。Python - 親プロセスでサブプロセスが完了したタイミングを判断するTkinter GUIまだ対話可能
私は、次の(主にstackoverflowの)リンクで見られるものと多くの方法を試してみましたforループまたはwhileループを使用して行を読み込むメソッドを使用できないか、ループがすべての読み込みを終了するのを待っているGUIで終了することがわかりました。私が決めたことから、何らかの糸が必要です。しかし、上記のリンクを通していくつかの例を使用しても、私の問題は解決していないようです。たとえば、[4]のコードを動作させて自分のコードに合うようにすると、プログラムが終了するまでGUIがフリーズすることになります。私のコードの
フォーマット:
class MyClass(tk.Frame):
def _init_(self,parent):
# calls constructor of inherited class
# other relevant code to initiate
self.initUI()
def runButtonFunction(self):
# self.process = Popen(program_I_want_to_open)
# ?? Need some way to determine when subprocess has
# exited so I can process the results created by that subprocess
def stopButtonFunction(self):
# terminates the subprocess created in run and its children at
# any moment subprocess is running
def initUI(self):
# creates all UI widgets, one of which is a button starts the
# subprocess and another button that can terminate the subprocess
は私がしたい機能の種類を達成するためにどのようなアプローチを探してすべきですか?コンセプトアドバイス、擬似コード、実際のコード例は非常に役に立ちます。
意味が分からないものを明確にすることができます。