CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

CTkButton.bind() will throw a TypeError if _text_label is None

Open gpergrossi opened this issue 2 years ago • 2 comments

When calling CTkButton.bind() on a button with no text string or an empty text string you will get a TypeError: 'NoneType' does not object has no attribute 'bind'. This is because when the text string is empty or missing, the _text_label is deleted.

This issue could be resolved with:

if self._text_label is not None:
    self._text_label.bind(sequence, command, add=True)

gpergrossi avatar Dec 21 '22 19:12 gpergrossi

I also ran into this problem. I was attempting to make a button that was entirely an image (no text) and got the same error. I tried using " " as the text, but the button only called the callback function when I clicked to right of the image (which is where I presume " " was), and not the image.

JungleDifferential avatar Dec 21 '22 23:12 JungleDifferential

Problem is fixed now, next version will be uploaded soon.

TomSchimansky avatar Dec 25 '22 20:12 TomSchimansky

Fixed with version 5.0.4.

TomSchimansky avatar Jan 21 '23 13:01 TomSchimansky