fix widget bind if clause error

This commit is contained in:
Tom Schimansky 2022-12-06 19:25:00 +01:00
parent 5a17b1243e
commit 3d86b5a14f
12 changed files with 13 additions and 13 deletions

View File

@ -538,7 +538,7 @@ class CTkButton(CTkBaseClass):
def bind(self, sequence: str = None, command: Callable = None, add: Union[str, bool] = True):
""" called on the tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._canvas.bind(sequence, command, add=True)
self._text_label.bind(sequence, command, add=True)

View File

@ -437,7 +437,7 @@ class CTkCheckBox(CTkBaseClass):
def bind(self, sequence: str = None, command: Callable = None, add: Union[str, bool] = True):
""" called on the tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._canvas.bind(sequence, command, add=True)
self._text_label.bind(sequence, command, add=True)

View File

@ -400,7 +400,7 @@ class CTkComboBox(CTkBaseClass):
def bind(self, sequence=None, command=None, add=True):
""" called on the tkinter.Entry """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._entry.bind(sequence, command, add=True)

View File

@ -283,7 +283,7 @@ class CTkEntry(CTkBaseClass):
def bind(self, sequence=None, command=None, add=True):
""" called on the tkinter.Entry """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._entry.bind(sequence, command, add=True)

View File

@ -249,12 +249,12 @@ class CTkLabel(CTkBaseClass):
def bind(self, sequence: str = None, command: Callable = None, add: str = True):
""" called on the tkinter.Label and tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._canvas.bind(sequence, command, add=True)
self._label.bind(sequence, command, add=True)
def unbind(self, sequence: str, funcid: Optional[str] = None):
def unbind(self, sequence: str = None, funcid: Optional[str] = None):
""" called on the tkinter.Label and tkinter.Canvas """
if funcid is not None:
raise ValueError("'funcid' argument can only be None, because there is a bug in" +

View File

@ -398,7 +398,7 @@ class CTkOptionMenu(CTkBaseClass):
def bind(self, sequence: str = None, command: Callable = None, add: Union[str, bool] = True):
""" called on the tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._canvas.bind(sequence, command, add=True)
self._text_label.bind(sequence, command, add=True)

View File

@ -291,7 +291,7 @@ class CTkProgressBar(CTkBaseClass):
def bind(self, sequence: str = None, command: Callable = None, add: Union[str, bool] = True):
""" called on the tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._canvas.bind(sequence, command, add=True)

View File

@ -405,7 +405,7 @@ class CTkRadioButton(CTkBaseClass):
def bind(self, sequence: str = None, command: Callable = None, add: Union[str, bool] = True):
""" called on the tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._canvas.bind(sequence, command, add=True)
self._text_label.bind(sequence, command, add=True)

View File

@ -259,7 +259,7 @@ class CTkScrollbar(CTkBaseClass):
def bind(self, sequence=None, command=None, add=True):
""" called on the tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._canvas.bind(sequence, command, add=True)

View File

@ -375,7 +375,7 @@ class CTkSlider(CTkBaseClass):
def bind(self, sequence: str = None, command: Callable = None, add: Union[str, bool] = True):
""" called on the tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._canvas.bind(sequence, command, add=True)

View File

@ -444,7 +444,7 @@ class CTkSwitch(CTkBaseClass):
def bind(self, sequence: str = None, command: Callable = None, add: Union[str, bool] = True):
""" called on the tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._canvas.bind(sequence, command, add=True)
self._text_label.bind(sequence, command, add=True)

View File

@ -328,7 +328,7 @@ class CTkTextbox(CTkBaseClass):
def bind(self, sequence: str = None, command: Callable = None, add: Union[str, bool] = True):
""" called on the tkinter.Canvas """
if add != "+" or add is not True:
if not (add == "+" or add is True):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._textbox.bind(sequence, command, add=True)