Tkinter LabelFrame

   Tkinter LabelFrame: 在一个labelframe一个简单的容器构件。其主要目的是作为一个间隔或复杂的窗口布局容器.
在一个labelframe一个简单的容器构件。其主要目的是作为一个间隔或复杂的窗口布局容器.

该部件有一帧的功能,加上能够显示标签.

语法:

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

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

参数:

  • master: 这代表了父窗口.

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

OptionDescription
bgThe normal background color displayed behind the label and indicator.
bdThe size of the border around the indicator. Default is 2 pixels.
cursorIf you set this option to a cursor name (arrow, dot etc.), the mouse cursor will change to that pattern when it is over the checkbutton.
fontThe vertical dimension of the new frame.
heightThe vertical dimension of the new frame.
labelAnchorSpecifies where to place the label.
highlightbackgroundColor of the focus highlight when the frame does not have focus.
highlightcolorColor shown in the focus highlight when the frame has the focus.
highlightthicknessThickness of the focus highlight.
reliefWith the default value, relief=FLAT, the checkbutton does not stand out from its background. You may set this option to any of the other styles
textSpecifies a string to be displayed inside the widget.
widthSpecifies the desired width for the window.

例子:

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

from Tkinter import *

root = Tk()

labelframe = LabelFrame(root, text="This is a LabelFrame")
labelframe.pack(fill="both", expand="yes")
 
left = Label(labelframe, text="Inside the LabelFrame")
left.pack()
 
root.mainloop()

这将产生以下结果:

 

 

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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值