CustomTkinter
CustomTkinter copied to clipboard
Align content in CTKButtons
Please consider adding another flag in the creation of CTKButtons to allow for the text and image to be aligned. I've attached an image below of the benefits to adding this optional flag. I personally think this looks a lot more clean and more professional, and could be a great option for users looking keep text looking clean and oriented.
It could just be an optional flag, like:
button1 = ctk.CTkButton(self.frame, text ="Start Program", image=self.listIcon), compound="left", align_content="w")
button2 = ctk.CTkButton(self.frame, text ="Save", image=self.saveIcon), compound="right", align_content="e")
I went to manually add it and submit a pull request, since it seems like a pretty easy replacement of some of the sticky
arguments in the button's draw
method, but I found myself having some issues with the alignment. I think the best and simplest way is to have the image_label
and text_label
masters be a separate frame, which can be oriented as needed. I almost have it working and will submit it in a pull request when done.
Any thoughts?
I will have a look at this!
Good Morning... is this problem now solved ? If yes.. what ist the special word ? align_content ?? at the moment not integrated in the current version..
It's not solved yet, but I will do it in the next days. The pull request provided by @DomGravante was not sufficient, because it destroyed other functionality, but I will try to do it...
With version 5.0.0 I added the anchor
and border_spaing
option, the text and image can now be aligned in the button.