Python 2.7 我的Gui没有';单击按钮后不显示输出文本

Python 2.7 我的Gui没有';单击按钮后不显示输出文本,python-2.7,user-interface,tkinter,Python 2.7,User Interface,Tkinter,这是一个Python新手。 我正在编写这个简单的GUI: from Tkinter import * root = Tk() def print_name(): return 'Here is Steve' here_goes_text = print_name() button = Button(root,text='Say hello',command = print_name) button.pack() text = Text(root) text.insert(END,

这是一个Python新手。 我正在编写这个简单的GUI:

from Tkinter import *

root = Tk()

def print_name():
   return  'Here is Steve'

here_goes_text = print_name()

button = Button(root,text='Say hello',command = print_name)
button.pack()
text = Text(root)
text.insert(END,here_goes_text)
text.pack()

root.mainloop()
我所希望的是,在我点击“说你好”按钮后,Gui会在下面的文本小部件上显示“你好,我是史蒂夫”。 不幸的是,现在当我运行该程序时,它会在下面的文本中立即显示“嗨,我是史蒂夫”,如果我单击“打招呼”按钮,什么都不会发生


我做错了什么?

您让tkinter在tkinter旁边加载打印名称。。。。 尝试 使用打印(“这里是steave”)而不是
return“here is steave”

它会立即显示,因为您正在立即插入它(
text.insert(END,here\u goes\u text)
)嗨,布莱恩·奥克利,好的,我明白了。但我仍然不知道如何解决这类问题,将插入button click文本的行移动到单击按钮时调用的函数中。此外,您不能期望在事件发生后返回任何值。