I'm using the customtkinter library to create a rounded button with an outline, this button can contain a variable length of text and the button itself should dynamically resize.
There is no wraplength
attribute for customtkinter so I can't just do something like self.configure(wraplength = self.winfo_width())
as that will return an error telling me that it does not support wraplength.
One solution I've come up with is making a customtkinter frame (so I can retain the rounded edges) and binding all of the hover and click events to it, then inserting a tk.label inside of it which will then have the wrapping.
Currently CustomTk does not support that option as you can see at this. But if you don't mind hack CustomTk, you can do like this.(It may not work in the future.)
import customtkinter as ctk
root = ctk.CTk()
button = ctk.CTkButton(root, text='aaa bbb ccc ddd')
button._text_label.configure(wraplength=50)
button.pack()
root.mainloop()
One edge case is if you initialize your button with no text, e.g.
button = ctk.CTkButton(root, text='')
Then button._text_label will be NoneType. You can get around this by initializing with some text, changing the wraplength, then running
button.configure(text='')
What about posting a feature request on here?