Tk之Label and Entry Widgets

Label常见的参数:

-anchor => 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw' | ' center '
Causes the text to stick to that position in the Label widget. This won't be obvious unless the Label is forced to be larger than standard size.
-background => color
Sets the background color of the Label to color .
-bitmap => bitmap
Displays the bitmap contained in bitmap instead of text.
-borderwidth => amount
Changes the width of the edges of the Label.
-cursor => cursorname
Changes the cursor to cursorname when the mouse is over this widget.
-font => fontname
Indicates that the text in the widget will be displayed with fontname .
-foreground => color
Changes the text of the Button (or the bitmap) to color .
-height => amount
Sets the height of the Label to amount ; amount is a valid screen distance.
-highlightbackground => color
Sets the color of the focus rectangle when the widget is not in focus to color .
-highlightcolor => color
Sets the color of the focus rectangle when the widget has focus to color .
-highlightthickness => amount
Sets the width of the focus rectangle. Default is 0 for the Label.
-image => imgptr
Displays the image to which imgptr points, instead of text.
-justify => 'left' | 'right' | ' center '
Sets the side of the Label against which multiline text will justify.
-padx => amount
Adds extra space inside the edge to the left and right of the Label.
-pady => amount
Adds extra space inside the edge to the top and bottom of the Label.
-relief => ' flat ' | 'groove' | 'raised' | 'ridge' | 'sunken'
Changes the type of edges drawn around the Button.
-takefocus => 0 | 1 | undef
Changes the ability of the Label to have the focus or not.
-text => text
Displays a text string in the Label.
-textvariable => /$variable
Points to the variable containing text to be displayed in the Label. Label will change automatically as $variable changes.
-underline => n
Causes the n th character to be underlined. Allows that key to invoke the widget when it has the focus. Default value is -1 (no character underlined).
-width => amount
Causes the Label width to be amount .
-wraplength => amount
Indicates that the text in the Label will wrap when it gets longer than amount .

Entry的参数:
-background => color
Sets the background color of the Entry widget. This is the area behind the text.
-borderwidth => amount
Changes the width of the outside edge of the widget. Default value is 2.
-cursor => cursorname
Changes the cursor to cursorname when it is over the widget.
-exportselection => 0 | 1
If the Boolean value specified is true, any text selected and copied will be exported to the windowing system's clipboard.
-font => fontname
Changes the font displayed in the Entry to fontname .
-foreground => color
Changes the color of the text.
-highlightbackground => color
Sets the color the highlight rectangle should be when the widget does not have the keyboard focus.
-highlightcolor => color
Sets the color the highlight rectangle should be when the widget does have the keyboard focus.
-highlightthickness => amount
Sets the thickness of the highlight rectangle around the widget. Default is 2.
-insertbackground => color
Sets the color of the insert cursor.
-insertborderwidth => amount
Sets the width of the insert cursor's border. Normally used in conjunction with -ipadx and -ipady options for the geometry manager.
-insertofftime => milliseconds
Sets the amount of time the insert cursor is off in the Entry widget.
-insertontime => milliseconds
Sets the amount of time the insert cursor is on in the Entry widget.
-insertwidth => amount
Sets the width of the insert cursor. Default is 2.
-invalidcommand => callback
Specifies a callback to invoke when -validatecommand returns a false result—undef disables this feature (default). Typically, just call the bell method.
-justify => ' left ' | 'right' | 'center'
Sets the justification of the text in the Entry widget.
-relief => 'flat'|'groove'|'raised'|'ridge'|' sunken '|'solid'
Sets the relief of the outside edges of the Entry widget.
-selectbackground => color
Sets the background color of any selected text in the Entry widget.
-selectborderwidth => amount
Sets the width of the selection highlight's border.
-selectforeground => color
Sets the text color of any selected text in the Entry widget.
-show => char
Sets the character that should be displayed instead of the actual text typed.
-state => ' normal ' | 'disabled' | 'active'
Indicates the state of the Entry.
-takefocus => 0 | 1 | undef
Allows or disallows this widget to have the keyboard focus.
-textvariable => /$variable
Sets the variable associated with the information typed in the Entry widget.
-validate => validateMode
Specifies the events that invoke the -validatecommand callback: none (default), focus , focusin , focusout , key , or all .
-validatecommand => callback
Specifies a callback that validates the input; undef disables this feature (default). The callback returns false to reject the new input and invoke the -invalidcommand callback or true to accept the input.
-width => amount
Sets the width of the Entry in characters.
-xscrollcommand => callback
Assigns a callback to use when scrolling back and forth.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

惹不起的程咬金

来都来了,不赏点银子么

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值