How to put labels in the frame that do not move when changing the length of the text? #2577
-
Hello experienced friends! @Akascape import customtkinter as ctk
from tkinter import CENTER
root = ctk.CTk()
root.geometry('400x400')
frame = ctk.CTkFrame(root, width=385, height=385)
frame.place(relx=0.5, rely=0.5, anchor=CENTER)
lable_1 = ctk.CTkLabel(frame, text='A sample text', font=ctk.CTkFont(size=25))
lable_1.place(relx=0.25, rely=0.4, anchor=CENTER)
lable_2 = ctk.CTkLabel(frame, text='A sample text with nothing', font=ctk.CTkFont(size=25))
lable_2.place(relx=0.25, rely=0.6, anchor=CENTER)
root.mainloop() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@Nigacatch Sorry for the late reply, lable_2._label.config(wrap=200) Also make sure you use the anchor properly in place method. |
Beta Was this translation helpful? Give feedback.
@Nigacatch I recommend you to use grid method in this case, and use anchor parameter in the ctklabel.