Tkinter (24) check button unit ttk.Checkbutton

Time:2021-1-15

Creation of TTK check button part and its options

w = ttk.Checkbutton(parent, option=value, ...)
option explain
class_ Component classification name cannot be changed after creation
command The function called by the component
compound The position of the image relative to the string, tk.TOP/BOTTOM/LEFT/RIGHT , set as picture priority, no string
cursor The mouse that appears when the mouse hovers over a button
image Image on button
offvalue Variable value when component status value is 0
onvalue Variable value when component status value is 1
style Generate the style of the part
takefocus Keyboard focus, 0 or 1 (internal)
text Component text
textvariable Stringvar (), changing the variable updates the text on the part
underline At the index of the underline, – 1 if none
variable Selected button variable value
width A positive value represents the number of words in the standard dimension of the text, and a negative value represents the number of words in the minimum standard dimension

Non general method of TTK check button

method explain
invoke() Click the button to return the return value of the callback

To be continued

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


Jason Yang

Recommended Today

Document the third-party framework you use

BackgroundLibrary: generate shape from label implementation “androidx.appcompat:appcompat:$supportVersion” //for androidx implementation ‘com.noober.background:core:1.6.5’ MagicIndicator: indicator repositories { … maven { url “https://jitpack.io” } } implementation ‘com.github.hackware1993:MagicIndicator:1.7.0’ // for androidx AnyLayer: floating floor (pop up) allprojects { repositories { maven { url ‘https://www.jitpack.io’ } } } implementation ‘com.github.goweii:AnyLayer:3.6.0-androidx’ androidautosize: screen adaptation scheme `implementation ‘me.jessyan:autosize:1.2.1’` glide: image loading implementation […]