【问题标题】:Python: Use multiple python windows for a same programPython:对同一个程序使用多个 Python 窗口
【发布时间】:2017-10-29 18:32:09
【问题描述】:

有没有办法让 python 程序能够打开和管理多个终端窗口?比如,在我的脚本中,打开两个窗口,当我在第一个窗口中写一些东西时,比如

d = input()

它在第二个打印它?如果可能,我想避免使用套接字,并避免使用像 Tkinter 这样的 python GUI 库......但是如果没有其他方法也没关系,如果可能的话就避免它。 谢谢。

【问题讨论】:

  • 我不知道如何打开一个新终端,因为它取决于你的系统,但是看看 python 框中的多处理库

标签: python shell multiprocessing shared-libraries multiple-instances


【解决方案1】:

是的,你可以!

1) 您可以将 input_output 数据保存在一个文件中,并在另一个 python 脚本中使用它(实时)。

2) 您可以使用多处理模块来处理多进程阅读更多内容: https://pymotw.com/2/multiprocessing/basics.html

3) 你可以使用多线程模块来处理多线程,更多信息请阅读:https://www.tutorialspoint.com/python/python_multithreading.htm

4) 你可以使用 sys 和 subprocess 模块来使用 pip 端口

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-29
    • 2020-12-31
    相关资源
    最近更新 更多