Python 3 – Tkinter 填充样式
小部件的填充样式指的是小部件外部的某些模拟 3D 效果。 下面是一行按钮的截图,展示了所有可能的填充样式。-
下面是可以用于填充属性的可能常量列表 –
- FLAT
- RAISED
- SUNKEN
- GROOVE
- RIDGE
范例
# !/usr/bin/python3
from tkinter import *
import tkinter
top = Tk()
B1 = Button(top, text = "FLAT", relief = FLAT )
B2 = Button(top, text = "RAISED", relief = RAISED )
B3 = Button(top, text = "SUNKEN", relief = SUNKEN )
B4 = Button(top, text = "GROOVE", relief = GROOVE )
B5 = Button(top, text = "RIDGE", relief = RIDGE )
B1.pack()
B2.pack()
B3.pack()
B4.pack()
B5.pack()
top.mainloop()
结果
当上述代码被执行时,它会产生如下结果 –