Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 创建一个简单的GUI,请求输入,然后运行脚本_Python_User Interface_Input - Fatal编程技术网

Python 创建一个简单的GUI,请求输入,然后运行脚本

Python 创建一个简单的GUI,请求输入,然后运行脚本,python,user-interface,input,Python,User Interface,Input,我有一个python脚本,但现在我正在尝试一个GUI界面,它有一些文本框,用户可以将值填入一些变量,然后单击“运行”来运行脚本 最简单的方法是什么 非常感谢用python创建GUI,有很多可用的软件包。我正在使用其中一个(如下所示): 它将打印用户在终端上给出的输入文本。最简单的方法之一是使用TkInter。PyQt是一个功能强大且流行的跨平台GUI库。本教程很好地开始了 from Tkinter import * master = Tk() text_box = Entry(master)

我有一个python脚本,但现在我正在尝试一个GUI界面,它有一些文本框,用户可以将值填入一些变量,然后单击“运行”来运行脚本

最简单的方法是什么


非常感谢用python创建GUI,有很多可用的软件包。我正在使用其中一个(如下所示):


它将打印用户在终端上给出的输入文本。

最简单的方法之一是使用TkInter。
PyQt
是一个功能强大且流行的跨平台GUI库。本教程很好地开始了
from Tkinter import *

master = Tk()

text_box = Entry(master)
text_box.pack()

text_box.focus_set()

def callback():
    print text_box.get()

button = Button(master, text="ok", width=10, command=callback)
button.pack()
mainloop()