【发布时间】:2021-07-30 13:42:21
【问题描述】:
我想在我的 GUI 中有一个标签,文本左对齐。我尝试使用anchor,但如果字符串由多行组成,它似乎不起作用。
我的代码如下所示:
lbl_welcome = tk.Label(fr_welcome, anchor = 'w', text = "First line\n and this is the second")
标签和框架位于西北方向,使用sticky。
我得到的看起来像这样:
GUI with the label
这里标签/文本框向左对齐,但不是文本本身。它可以正常工作,但是对于不存在 \n 的单行字符串。
【问题讨论】:
标签: python tkinter label anchor