def hello(): print('hello there')from tkinter import *tk = Tk()btn = Button(tk, text='click me', command=hello)btn.pack()tk.mainloop()在程序的最后要加tk.mainloop(),调用mainloop方法就可正常显示tkinter窗口
posted on 2020-10-31 22:56 坐看浮云飘飘飘 阅读(1046) 评论(0) 编辑 收藏 举报