15_组件Message

Message

消息
显示多行文本消息,能够自动换行,并调整文本的尺寸使其适应给定的尺寸。
import tkinter as tk

window = tk.Tk()
window.title('hello thinter')
height= window.winfo_screenheight()
width= window.winfo_screenwidth()
window.geometry('400x300+%d+%d'%((width-400)/2,(height-300)/2))

message = tk.Message(window, text="这是一则消息,这是一则消息,这是一则消息", width=80)
message.pack()

window.mainloop()
选项 含义
aspect 1,设置高宽比,即宽度高度的百分比的值
2,默认值是150(宽度比高度大50%)
3,注意:如果设置了width选项的值,该选项将被忽略
其他选项 参考其他组件
posted @ 2022-10-09 10:25  interesting5319  阅读(35)  评论(0)    收藏  举报