私は3つの "メッセージウィジェット"を作成していますが、内容に応じて幅と高さが変更されているようですが、そのようなことを防ぐことは可能でしょうか?Tkinter Messageウィジェットのサイズ変更を止めるには?
from tkinter import *
root = Tk()
root.configure(background = 'Yellow')
root.geometry('500x400')
a = '{}'.format('The Elepthan is Big')
b = '{}'.format('The Bird')
c = '{}'.format('The Lion is big and ferocious, kills any animal')
msg = Message(root, text = a, width=300, justify='left')
msg.config(bg='lightgreen',relief=RIDGE, font=('times', 9), pady=-2, borderwidth=3)
msg.pack()
msg = Message(root, text = b, width=300, justify='left')
msg.config(bg='lightgreen',relief=RIDGE, font=('times', 9), pady=-2, borderwidth=3)
msg.pack()
msg = Message(root, text = c, width=300, justify='left')
msg.config(bg='lightgreen',relief=RIDGE, font=('times', 9), pady=-2, borderwidth=3)
msg.pack()
root.mainloop()
はい、その可能。メッセージウィジェットを作成するために使用しているコードのサンプルを提供し、サイズ変更を防ぐために欠落しているものを教えてください。グリッドに重さを加える必要があるかもしれません。 –
問題があることを示す[mcve]を入力してください。 –
@BryanOakley同じ幅のすべてのメッセージウィジェットが必要ですが、内容に応じてサイズが変更されます - espktro 8分前 – espktro