【发布时间】:2021-08-11 13:58:11
【问题描述】:
标签:“Right Text”应该在 tkinter 窗口的右侧。如图所示。
为此,我尝试了下面的代码,但它不在右边。
m_root = Tk()
m_root.wm_state('zoomed')
label_time = Label(m_root, text="Right Text", anchor="e", justify="right").grid()
m_root.mainloop()
【问题讨论】:
-
了解 Tkinter 中的布局管理器,for example。你的问题是网格函数错误。
-
有多种方法可以做到这一点。正确的方法取决于窗口中的其他内容。你真的想要一个右边只有一个标签的窗口,还是窗口会有其他东西?您如何添加其他小部件(
pack?grid?) -
@BryanOakley 右侧只有单个标签,其他标签也使用网格
标签: python python-3.x tkinter justify layout-anchor