Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 QTextEdit 框中显示来自 python/PySide 应用程序的所有标准输出,但我能找到的只是如何从子进程中捕获标准输出。这甚至可能吗?理想情况下,我想定义某种回调,一旦将任何内容添加到标准输出就会触发,所以我不需要循环
您可以将标准输出重定向到某个临时文件,然后查看该文件。
sys.stdout.close() sys.stdout = open("out.txt", "w")