作者:黄承念63772 | 来源:互联网 | 2023-10-16 17:52
一、纵向排列_体验expand参数与fill参数的应用fromtkinterimport*rootTk()root.title(纵向排列_体验expand参数与fill参数的
一、纵向排列_体验expand参数与fill参数的应用
from tkinter import *root=Tk()
root.title("纵向排列_体验expand参数与fill参数的应用")
root.geometry("600x300")Label(root,text="今天打豆豆lalala",bg="red",fg="white",font="Times 24 bold").pack(fill=X)
Label(root,text="明天打豆豆lalala",bg="lightyellow",fg="black",font="Times 24 bold").pack(fill=BOTH,expand=True)
Label(root,text="后天打豆豆lalala",bg="lightblue",fg="blue",font="Times 24 bold").pack(fill=X)root.mainloop()
二、横向排列_体验expand参数与fill参数的应用
from tkinter import *root=Tk()
root.title("横向排列_体验expand参数与fill参数的应用")
root.geometry("600x300")Label(root,text="今天打豆豆lalala",bg="red",fg="white",font="Times 24 bold").pack(side=LEFT,fill=Y)
Label(root,text="明天打豆豆lalala",bg="lightyellow",fg="black",font="Times 24 bold").pack(side=LEFT,fill=BOTH,expand=True)
Label(root,text="后天打豆豆lalala",bg="lightblue",fg="blue",font="Times 24 bold").pack(side=LEFT,fill=Y)root.mainloop()