在新的控制台窗口中打开Python线程 [英] Opening a Python thread in a new console window

查看:144
本文介绍了在新的控制台窗口中打开Python线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个既可以启动视图窗口(控制台)又可以启动命令行的程序.在视图窗口中,它将显示恒定更新,而命令行窗口将使用raw_input()接受影响视图窗口的命令.我正在考虑为此使用线程,但是我不知道如何在新的控制台窗口中启动线程.我该怎么办?

I am trying to make a program that will launch both a view window (console) and a command line. In the view window, it would show constant updates, while the command line window would use raw_input() to accept commands that affect the view window. I am thinking about using threads for this, but I have no idea how to launch a thread in a new console window. How would I do that?

推荐答案

请重新检查您的问题,而不是使用控制台或终端窗口.您试图做的是创建一个GUI.有许多跨平台的工具包,包括Wx和Tkinter,它们的小部件可以完全满足您的需求.用于输出的文本框和用于读取键盘输入的输入小部件.另外,您可以将它们包装在带有标题,帮助,打开/保存/关闭等的漂亮框架中.

Rather than use a console or terminal window, re-examine your problem. What you are trying to do is create a GUI. There are a number of cross-platform toolkits including Wx and Tkinter that have widgets to do exactly what you want. A text box for output and an entry widget for reading keyboard input. Plus you can wrap them in a nice frame with titles, help, open/save/close, etc.

这篇关于在新的控制台窗口中打开Python线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆