UYOU
这是我用python 3.5.2做的方式:from tkinter import *root=Tk()def retrieve_input():
inputValue=textBox.get("1.0","end-1c")
print(inputValue)textBox=Text(root, height=2, width=10)textBox.pack()buttonCommit=Button(root, height=1, width=10, text="Commit",
command=lambda: retrieve_input())#command=lambda: retrieve_input() >>> just means do this when i press the buttonbuttonCommit.pack()mainloop()与此同时,当我在文本小部件中键入“blah blah”并按下按钮时,无论打字输出的是什么。所以我认为这是将用户输入从Text小部件存储到变量的答案。