Tkinter (28) label components ttk.Label

Time:2021-1-10

Creation of TTK tag part and its options

w = ttk.Label(parent, option=value, ...)
option explain
anchor The positioning point of components is internally defined as center / w / E
background background color
borderwidth Dimension of part frame
class_ Component classification name cannot be changed after creation
compound When a graph is shared with a text, the position of the graph relative to the text is internally set as’ none ‘(picture first, string displayed if none),’ bottom ‘/’left’ /’top ‘/’right’ /’image ‘/’text’
cursor When the mouse hovers over the button, the empty string inherits the options of the parent part
font Text font
foreground Text foreground
image The image im0 can be in the format of (im0, ‘state)_ 1’, im_ 1, … , ‘state_ i’, im_ i) The default image is im0, state_ IM is displayed in I status_ i, state_ I can be a combination of various states, and ‘! State’ means not in this state
justify Alignment of multiline text, left / right / Center
padding Increase the outer space of a picture or document
relief Pattern of outer frame
style Generate the style of the part
takefocus Keyboard focus, ‘(default) is the same as false, false or true
text String of the part
textvariable String variable of the part, prior to text
underline Set the position of the bottom line, and set – 1 as none
width The standard number of component words is degree, and the negative number indicates the minimum standard number of component words
wraplength Text line width

To be continued

This work adoptsCC agreementReprint must indicate the author and the link of this article


Jason Yang

Recommended Today

Wu Taiyin: scenarios and best practices of Huawei’s consumer cloud service Cassandra

Hello, I’m Wu Taiyin from Huawei consumer cloud.   What I share today is mainly the application scenarios and best practices of Huawei consumer cloud service using Cassandra. What I may share with other guests is not quite the same, because the previous guests said that there are some modifications to the native code of […]