1.创建

from tkinter import *

root=Tk()
root.title('Hello tkinter!')
root.mainloop()

2.使用内置位图

from tkinter import *

root=Tk()
label=Label(root,bitmap=’hourglass’)
label.pack()
root.mainloop()

还有这些选项 error,hourglass,info,questhead,question,warning,gray12,gray25,gray50,gray75

3.改变颜色和宽高

label=Label(root,fg='red',bg='blue',text='Hello')
label=Label(root,fg='red',bg='blue',text='Hello',width='10',height='3')

4.使用图像与文本

from tkinter import *

root=Tk()
label=Label(root,fg='red',bg='blue',text='Hello',width='100',height='300',bitmap='error')
label.pack()
root.mainloop()

from tkinter import *

root=Tk()
label=Label(root,fg='red',bg='blue',text='Hello',width='100',height='300',bitmap='error',compound='right')
label.pack()
root.mainloop()

5.文本多行显示

from tkinter import *

root=Tk()
label=Label(root,text='Hello',width='100',height='300',wraplength='1')
label.pack()
root.mainloop()

参考资料:

Tkinter编程代码实例-Jcodeer,Zhang

 

Python3 Tkinter-Label的更多相关文章

  1. Tkinter Label(标签)

      Tkinter Label : 这个小工具,实现了显示框,在那里你可以把文本或图像.这个widget中显示的文本可以在任何时候你想要更新.   这个小工具,实现了显示框,在那里你可以把文本或图像. ...

  2. python3+tkinter实现的黑白棋,代码完整 100%能运行

    今天分享给大家的是采用Python3+tkinter制作而成的小项目--黑白棋 tkinter是Python内置的图形化模块,简单易用,一般的小型UI程序可以快速用它实现,具体的tkinter相关知识 ...

  3. Python3 tkinter基础 LabelFrame StringVar 单击按钮,Label中显示的文字更换

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  4. Python3 tkinter基础 Label 显示的文字换行

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  5. Python3 tkinter基础 Label pack 设置控件在窗体中的位置

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  6. Python3 tkinter基础 Label justify 多行字符串左对齐

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  7. Python3 tkinter基础 Label compound 图片上显示文字 fg字体颜色 font字体大小

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  8. Python3 tkinter基础 Label imag显示图片

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  9. python3 tkinter模块

    一.tkinter 1.tkinter--tool kit interface工具包接口,用于GUI(Graphical User Interface)用户图形界面, 2.python3.x把Tkin ...

  10. Python3 tkinter基础 TK title 设置窗体的标题

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

随机推荐

  1. 外键参数 onupdate,ondelete等(cascade,no adcion,set null,restrict)

    MySQL外键约束On Delete.On Update各取值的含义 先看On Delete属性,可能取值如上图为:No Action, Cascade,Set Null, Restrict属性. 当 ...

  2. parsing XML document from class path resource [applicationtext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationtext.xml] cannot be opened because it does not e

    控制台异常: parsing XML document from class path resource [applicationtext.xml]; nested exception is java ...

  3. 分布式版本控制系统之Git

    Git Git 是目前世界上最先进的分布式版本控制系统(没有之一) 作用 源代码管理 为什么要进行源代码管理? 方便多人协同开发 方便版本控制 Git的诞生 作者是 Linux 之父:Linus Be ...

  4. js之广告

    涉及到offset等有关获取各种尺寸问题下 <!doctype html> <html lang="en"> <head> <meta c ...

  5. bootstrap-paginator分页插件的简单使用实例

    Document 21:36:40 简述:bootstrap-paginator是一款基于bootstrap的jQuery分页插件. githup项目地址:https://github.com/lyo ...

  6. 公司内部搭建git服务器

    前言 因为gitHub上的项目是公开的,不适合公司内部项目放在上面,而私人的需要收费,这绝非是我们愿意的.所以找了个跟gitHub很相似,但是又免费的gitLab.现在将搭建gitLab过程记录一下留 ...

  7. TCC : Tiny C Compiler (2018-2-6)

    饭墙下载,有缘上传: https://files.cnblogs.com/files/bhfdz/tcc-0.9.27-win32-bin.zip https://files.cnblogs.com/ ...

  8. Order Helper

    using System; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using Microsoft.Crm.Sdk.Messag ...

  9. log4j配置输出日志文件

    在测试程序时,有时候运行一次可能需要很久,把日志文件保存下来是很有必要的,本文给出了scala程序输出日志文件的方式,同时使用本人的另一篇博客中介绍的将log4j.properties放到程序jar包 ...

  10. 2.1 摄像头V4L2驱动框架分析

    学习目标:学习V4L2(V4L2:vidio for linux version 2)摄像头驱动框架,分析vivi.c(虚拟视频硬件相关)驱动源码程序,总结V4L2硬件相关的驱动的步骤:  一.V4L ...