使用side参数设置为RIGHT即可将组件放置在右侧。例如:

import tkinter as tk

root = tk.Tk()

label1 = tk.Label(root, text="Label 1")
label1.pack(side=tk.RIGHT)

label2 = tk.Label(root, text="Label 2")
label2.pack(side=tk.RIGHT)

root.mainloop()

这段代码将会在窗口的右侧放置两个标签组件。注意,pack方法默认会将组件放置在左侧。

tkinter的pack怎么放在右侧

原文地址: https://www.cveoy.top/t/topic/fxHD 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录