Python GUI - Tkinter Message(消息):这个小工具提供了一个多和不可编辑的对象,显示文本,自动断行和其内容的理由。
 
这个小工具提供了一个多和不可编辑的对象,显示文本,自动断行和其内容的理由.

它的功能是非常类似的标签部件,但它也可以自动换行的文本,维持一个给定的宽度或长宽比.

语法:

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

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

参数:

  • master: 这代表了父窗口.

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

Option Description
anchor 此选项控制文本的位置,如果部件比文本,还需要有更多的空间。默认为锚=中心,该中心可用空间的文本.
bg The normal background color displayed behind the label and indicator.
bitmap Set this option equal to a bitmap or image object and the label will display that graphic.
bd The size of the border around the indicator. Default is 2 pixels.
cursor If 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.
font If you are displaying text in this label (with the text or textvariable option, the font option specifies in what font that text will be displayed.
fg If you are displaying text or a bitmap in this label, this option specifies the color of the text. If you are displaying a bitmap, this is the color that will appear at the position of the 1-bits in the bitmap.
height The vertical dimension of the new frame.
image To display a static image in the label widget, set this option to an image object.
justify Specifies how multiple lines of text will be aligned with respect to each other: LEFT for flush left, CENTER for centered (the default), or RIGHT for right-justified.
padx Extra space added to the left and right of the text within the widget. Default is 1.
pady Extra space added above and below the text within the widget. Default is 1.
relief Specifies the appearance of a decorative border around the label. The default is FLAT; for other values.
text To display one or more lines of text in a label widget, set this option to a string containing the text. Internal newlines ("\n") will force a line break.
textvariable To slave the text displayed in a label widget to a control variable of classStringVar, set this option to that variable.
underline You can display an underline (_) below the nth letter of the text, counting from 0, by setting this option to n. The default is underline=-1, which means no underlining.
width Width of the label in characters (not pixels!). If this option is not set, the label will be sized to fit its contents.
wraplength You can limit the number of characters in each line by setting this option to the desired number. The default value, 0, means that lines will be broken only at newlines.

例子:

自行尝试下面的例子:

from Tkinter import *

root = Tk()

var = StringVar()
label = Message( root, textvariable=var, relief=RAISED ) var.set("Hey!? How are you doing?")
label.pack()
root.mainloop()

这将产生以下结果:

Tkinter Message的更多相关文章

  1. tkinter中的message

    from tkinter import * root =Tk() root.title("message练习") myText = "2019年12月13日,下午一个人, ...

  2. Python图形编程探索系列-07-程序登录界面设计

    设计任务 初步设计程序登录界面,详细分析设计步骤. 程序详细分析 基本框架设计 import tkinter as tk import tkinter.messagebox root = tk.Tk( ...

  3. Eclipse 4.2 failed to start after TEE is installed

    ---------------  VM Arguments---------------  jvm_args: -Dosgi.requiredJavaVersion=1.6 -Dhelp.lucene ...

  4. Tkinter教程之Message篇

    本文转载自:http://blog.csdn.net/jcodeer/article/details/1811326 '''Tkinter教程之Message篇'''#Message也是用来显示文本的 ...

  5. GUI的最终选择 Tkinter(八):Message组件、Spinbox组件、PanedWindow组件、Toplevel组件

    Message组件 Message(消息)组件是Label组件的变体,用于显示多行文本消息,Message组件能够自动执行,并调整文本的尺寸使其适应给定的尺寸. from tkinter import ...

  6. TKinter的常用组件

    python提供了多个图形开发界面的库,几个常用Python GUI库如下: Tkinter: Tkinter模块("Tk 接口")是Python的标准Tk GUI工具包的接口.T ...

  7. Python GUI with Tkinter (from youtube) 在youtube上能找到很多编程视频...

    Python GUI with Tkinter - 1 - Introduction以上链接是一个python tkinter视频系列的第一讲的链接.虽然英语不好,但是,程序还是看得懂的(照着做就可以 ...

  8. 串口调试工具(Python2.7+pyserial+Tkinter)

    需要与串口设备进行通讯,那么一个调试工具是必须的. 根据我自己的需要,写了个简易版本的串口调试工具: 预览图: ====================== 项目结构: COM --SerialHel ...

  9. Tkinter类之窗口部件类

    Tkinter类之窗口部件类 Tkinter支持15个核心的窗口部件,这个15个核心窗口部件类列表如下:窗口部件及说明:Button:一个简单的按钮,用来执行一个命令或别的操作.Canvas:组织图形 ...

随机推荐

  1. KAFKA 0.11 RHEL6.5安装

    KAFKA简介 KAFKA是一款分布式消息发布和订阅的系统. 官网:http://kafka.apache.org/ 1.下载KAFKA及JDK KAFKA下载地址: http://kafka.apa ...

  2. 基于Ubuntu16.04的GeForce GTX 1080驱动安装,遇到的问题及对应的解决方法

    1.在主机上插上GPU之后,查看设备: $ nvidia-smi Tue Dec :: +------------------------------------------------------- ...

  3. SQL Server插入或修改数据是中文乱码的问题

    SQL Server中乱码解决方案: 在Sql Server2005英文版中,如果未对Varchar类型的字段进行设置,那么很多朋友会发现向数据库中插入记录时,如果对应的varchar类型字段 的值为 ...

  4. CodeForces - 321E:Ciel and Gondolas (四边形不等式优化DP)

    题意:N个人排成一行,分成K组,要求每组的不和谐值之和最小. 思路:开始以为是斜率优化DP,但是每个区间的值其实已经知道了,即是没有和下标有关的未知数了,所以没必要用斜率. 四边形优化. dp[i][ ...

  5. JSP学习(三)JSP中的九个内置对象

    JSP中的九个内置对象 NO. 内置对象 类型 1 pageContext javax.servlet.jsp.PageContext 2 request javax.servlet.http.Htt ...

  6. LOJ2503 NOIP2014 解方程 【HASH】

    LOJ2503 NOIP2014 解方程 LINK 题目大意就是给你一个方程,让你求[1,m]中的解,其中系数非常大 看到是提高T3还是解方程就以为是神仙数学题 后来研究了一下高精之类的算法发现过不了 ...

  7. python正则的使用

    python的正则是通过re模块的支持 匹配的3个函数 match :只从字符串的开始与正则表达式匹配,匹配成功返回matchobject,否则返回none: re.match(pattern, st ...

  8. 【DUBBO】 Dubbo生成的设配类

    package com.alibaba.dubbo.rpc;import com.alibaba.dubbo.common.extension.ExtensionLoader;public class ...

  9. piwik docker 安装

    备注: 生产环境使用docker-compose  1. 安装docker && docker-compose    此处略过 2. 下载docker-compose  的文件   h ...

  10. hashids 了解

    用于隐藏真实的id 原理是从数字经过一个加盐(salted)算法产生一个哈希(hash)字符串.这样算法就是通过混淆使结果具有不可预测性,而唯一性依然由数字本身来达成,从而得到(类似 youtube ...