>>> from tkinter import ttk
>>> root=Tk()

>>> panewindow=ttk.Panedwindow(root,orient=HORIZONTAL)  #新建一个panedwindow 控件并排的窗口。HORIZONTAL就是横向并排
>>> panewindow.pack(fill=BOTH,expand=True)                          #
>>> frame=ttk.Frame(panewindow,width=100,height=300,relief=SUNKEN)  #新建第一个frame。 宽100,高度300,下陷的浮雕
>>> frame2=ttk.Frame(panewindow,width=400,height=400,relief=SUNKEN) #新建一个frame,宽400 高度也是400,下陷的浮雕 relief
>>> panewindow.add(frame,weight=1)  #这个width ??
>>> panewindow.add(frame2,weight=4)
>>> frame3=ttk.Frame(panewindow,width=50,height=400,relief=SUNKEN)
>>> panewindow.insert(1,frame3)  #从0 开始在第一个位置之前插入一个frame
>>>

>>> panewindow.forget(1)

 

The fill option tells the manager that the widget wants fill the entire space assigned to it. The value controls how to fill the space; BOTH means that the widget should expand both horisontally and vertically, X means that it should expand only horisontally, and Y means that it should expand only vertically.

The expand option tells the manager to assign additional space to the widget box. If the parent widget is made larger than necessary to hold all packed widgets, any exceeding space will be distributed among all widgets that have the expand option set to a non-zero value.

posted on 2017-09-23 22:44  uxiuxi  阅读(262)  评论(0)    收藏  举报