【发布时间】:2022-01-08 09:47:34
【问题描述】:
Label 小部件不换行。 Message 小部件将换行文本,但强制它大致为正方形。这是一个例子:
from Tkinter import *
root = Tk()
root.title("hello")
Message(root, text=48*'xxxxx ').grid(row=0, column=0, columnspan=3)
Label(root, text='Name:').grid(row=1, column=0)
Entry(root, width=50).grid(row=1, column=1)
Button(root, text="?").grid(row=1, column=2)
Button(root, text="Left").grid(row=2, column=0)
Button(root, text="Center").grid(row=2, column=1)
Button(root, text="Right").grid(row=2, column=2)
root.mainloop()
我知道我可以使用aspect=700 来更改形状,但我要避免这样的硬编码数字。
【问题讨论】: