Skip to main content

CTkLabel

Example Code

label = customtkinter.CTkLabel(app, text="CTkLabel", fg_color="transparent")

Arguments

argumentvalue
masterroot, tkinter.Frame or CTkFrame
textvariabletkinter.StringVar object
textstring
widthlabel width in px
heightlabel height in px
corner_radiuscorner radius in px
fg_colorforeground color, tuple: (light_color, dark_color) or single color or "transparent"
text_colorlabel text color, tuple: (light_color, dark_color) or single color
fontlabel text font, tuple: (font_name, size)
anchorcontrols where the text is positioned if the widget has more space than the text needs, default is "center"
compoundcontrol the postion of image relative to text, default is "center, other are: "top", "bottom", "left", "right"
justifyspecifies 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
padxextra space added left and right of the text, default is 1
padyextra space added above and below the text, default is 1

and other arguments of tkinter.Label

Methods

  • .configure(attribute=value, ...)

    All attributes can be configured, for example:

    label.configure(text="new text")
  • .cget(attribute_name)

    Pass attribute name as string and get current value of attribute, for example:

    text = label.cget("text")
  • .bind(sequence=None, command=None, add=None)

    Bind events to the label.