#from fileinput import filename
import tkinter as tk # 引入thinter 库
root = tk.Tk() #创建窗体root
#思路:先创建窗体,然后在窗体上建各种按钮,实现各种功能
def callback():
fileName = tk.filedialog.askopenfilename()
print(fileName)
tk.Button(root, text="打开文件", command=callback).pack()
root.mainloop() #运行程序