btn_import = tk.Button(root, text="导入CSV数据", bg="light yellow", fg="dark blue", command=import_csv_data, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black") btn_import.pack(side="left") btn_handle_missing_values = tk.Button(root, text="处理缺失值", bg="light yellow", fg="dark blue", command=handle_missing_values, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black") btn_handle_missing_values.pack(side="left") btn_normalize = tk.Button(root, text="标准化数值型数据", bg="light yellow", fg="dark blue", command=normalize_numeric_data, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black") btn_normalize.pack(side="left") split_button = tk.Button(root, text="划分训练集和测试集", bg="light yellow", fg="dark blue", command=split_train_test, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black") split_button.pack(side="left") button1 = tk.Button(root, text="散点图", bg="light yellow", fg="dark blue", command=import_csv_data, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black") button1.pack(side="left") 如何修改将这几个按钮在界面左侧竖列排列
时间: 2023-07-03 11:20:07 浏览: 83
btn 按钮切换
你可以将这几个按钮的 `side` 参数都修改为 `"top"`,这样它们就会垂直排列在界面的左侧。代码如下:
```
btn_import = tk.Button(root, text="导入CSV数据", bg="light yellow", fg="dark blue", command=import_csv_data, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black")
btn_import.pack(side="top")
btn_handle_missing_values = tk.Button(root, text="处理缺失值", bg="light yellow", fg="dark blue", command=handle_missing_values, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black")
btn_handle_missing_values.pack(side="top")
btn_normalize = tk.Button(root, text="标准化数值型数据", bg="light yellow", fg="dark blue", command=normalize_numeric_data, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black")
btn_normalize.pack(side="top")
split_button = tk.Button(root, text="划分训练集和测试集", bg="light yellow", fg="dark blue", command=split_train_test, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black")
split_button.pack(side="top")
button1 = tk.Button(root, text="散点图", bg="light yellow", fg="dark blue", command=import_csv_data, relief="raised", borderwidth=3, activebackground="light blue", activeforeground="black")
button1.pack(side="top")
```
这样,这几个按钮就会在界面的左侧竖列排列。
阅读全文