Python Tkinter Frame框架
Tkinter Python 框架集件组被用于组织的微件。它像一个容器 , 该容器可以用来保持其他部件。该矩形区域的屏幕的小部件以用于组织的 Python 应用。
语法框架控件的使用如下。
语法w=Frame(parent,options)
可能选项的列表如下。SN选项描述
1bd它表示边框宽度
2bg小部件的背景颜色
3cursor鼠标指针被更改为光标类型,设置为不同的值,如箭头、圆点等
4height框架的高度
5highlightbackground对焦时背景颜色的颜色
6highlightcolor小部件处于焦点时的文本颜色
7highlightthickness当小部件位于焦点下时,它指定边框周围的厚度
8relief它指定边框的类型。默认值FLAT
9width它表示小部件的宽度
实例fromtkinterimport*
top=Tk()
top.geometry("140x100")
frame=Frame(top)
frame.pack()
leftframe=Frame(top)
leftframe.pack(side=LEFT)
rightframe=Frame(top)
rightframe.pack(side=RIGHT)
btn1=Button(frame,text="Submit",fg="red",activebackground="red")
btn1.pack(side=LEFT)
btn2=Button(frame,text="Remove",fg="brown",activebackground="brown")
btn2.pack(side=RIGHT)
btn3=Button(rightframe,text="Add",fg="blue",activebackground="blue")
btn3.pack(side=LEFT)
btn4=Button(leftframe,text="Modify",fg="black",activebackground="white")
btn4.pack(side=RIGHT)
top.mainloop()
输出 :