简单的版本
- 初始化
root = tk.Tk()
root.title("title")
root.geometry("550x200+800+440") # 设置位置和坐标
- 文件选择器
# 打开对话框,选择文件夹
folder_path = filedialog.askdirectory()
print(folder_path)
- 弹窗消息
tkinter.messagebox.showwarning(title='Hi', message='请选择文件夹路径')
- 输入框
sale_number = tk.StringVar()
entry = tk.Entry(root, textvariable=sale_number, width=10, fg='grey').place(x=50, y=19)
- 标签
total_cnt_var = tk.StringVar()
tk.Label(root, textvariable=total_cnt_var, anchor="w").place(x=50, y=81)