Tkinter PanedWindow

     Tkinter PanedWindow: 一个PanedWindow是一个容器部件可能包含任何数量的窗格,水平或垂直排列
一个PanedWindow是一个容器部件可能包含任何数量的窗格,水平或垂直排列.

每个窗格中包含一个部件,每一双窗格由一个可移动的(通过鼠标移动)窗扇分开。移动窗扇导致要么被调整窗框侧面的部件.

语法:

这里是一个简单的语法来创建这个widget:

w = PanedWindow( master, option, ... )

参数:

  • master: 这代表了父窗口.

  • options:下面是这个小工具最常用的选项列表。这些选项可以作为键 - 值对以逗号分隔.

OptionDescription
bgThe color of the slider and arrowheads when the mouse is not over them.
bdThe width of the 3-d borders around the entire perimeter of the trough, and also the width of the 3-d effects on the arrowheads and slider. Default is no border around the trough, and a 2-pixel border around the arrowheads and slider.
borderwidthDefault is 2.
cursorThe cursor that appears when the mouse is over the window.
handlepadDefault is 8.
handlesizeDefault is 8.
heightNo default value.
orientDefault is HORIZONTAL.
reliefDefault is FLAT.
sashcursorNo default value.
sashreliefDefault is RAISED.
sashwidthDefault is 2.
showhandleNo default value
widthNo default value.

方法:

spinbox对象有这些方法:

Methods & Description
add(child, options)
Adds a child window to the paned window.
get(startindex [,endindex])
This method returns a specific character or a range of text.
config(options)
Modifies one or more widget options. If no options are given, the method returns a dictionary containing all current option values.

例子:

自己尝试下面的例子。下面是如何创建3窗格部件:

from Tkinter import *

m1 = PanedWindow()
m1.pack(fill=BOTH, expand=1)

left = Label(m1, text="left pane")
m1.add(left)

m2 = PanedWindow(m1, orient=VERTICAL)
m1.add(m2)

top = Label(m2, text="top pane")
m2.add(top)

bottom = Label(m2, text="bottom pane")
m2.add(bottom)

mainloop()

这将产生以下结果:

 

转载于:https://www.cnblogs.com/tkinter/p/5628823.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值