首页 > 编程语言 > 详细

python tk Lable

时间:2017-02-24 15:22:07      阅读:227      评论:0      收藏:0      [点我收藏+]

原文章

class Label(Widget):
    """Label widget which can display text and bitmaps."""
    def __init__(self, master=None, cnf={}, **kw):
        """Construct a label widget with the parent MASTER.

        STANDARD OPTIONS

            activebackground, activeforeground, anchor,
            background, bitmap, borderwidth, cursor,
            disabledforeground, font, foreground,
            highlightbackground, highlightcolor,
            highlightthickness, image, justify,
            padx, pady, relief, takefocus, text,
            textvariable, underline, wraplength

        WIDGET-SPECIFIC OPTIONS

            height, state, width

        """
        Widget.__init__(self, master, label, cnf, kw)
from tkinter import *

master = Tk()

w = Label(master, text="Hello FishC!")
w.pack()

mainloop()

 

PARAMETERs

1.master --->Tk()实例化的对象

2.text= --->静态文本

3.front= --->字体

4.height

5.width

6.fg/bg --->前景色或者背景色

7.padx

8.pady

9.anchor ---> 文本或图像在背景内容区的位置,可选值为(n,s,w,e,ne,nw,sw,se,center)eswn是东南西北英文的首字母,表示:上北下南左西右东

10.underline = index--->目标文字的索引值

11.justify---> center(default) LEFT RIGHT

12.textvariable--->文本动态更新 

Features

1.lable可以自动跟新文本,在文本更新时,lable也会自动更新

2.lable用于在屏幕上显示文本或者图像,文本可以换行,但是字体只能是单一字体

 

python tk Lable

原文:http://www.cnblogs.com/ezway/p/6438444.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!