fixed progressbar start stop speed increase #775, fixed transparent textbox #779, fixed binding for all widgets #250 #374 #380 #477 #480

This commit is contained in:
Tom Schimansky
2022-12-06 18:09:20 +01:00
parent dd223a15b5
commit a564bc35ef
15 changed files with 225 additions and 140 deletions

View File

@ -90,16 +90,20 @@ class CTkEntry(CTkBaseClass):
textvariable=self._textvariable,
**pop_from_dict_by_set(kwargs, self._valid_tk_entry_attributes))
self._create_grid()
check_kwargs_empty(kwargs, raise_error=True)
self._entry.bind('<FocusOut>', self._entry_focus_out)
self._entry.bind('<FocusIn>', self._entry_focus_in)
self._create_grid()
self._activate_placeholder()
self._create_bindings()
self._draw()
def _create_bindings(self, sequence: Optional[str] = None):
""" set necessary bindings for functionality of widget, will overwrite other bindings """
if sequence is None or sequence == "<FocusIn>":
self._entry.bind("<FocusIn>", self._entry_focus_in)
if sequence is None or sequence == "<FocusOut>":
self._entry.bind("<FocusOut>", self._entry_focus_out)
def _create_grid(self):
self._canvas.grid(column=0, row=0, sticky="nswe")
@ -275,13 +279,19 @@ class CTkEntry(CTkBaseClass):
else:
return super().cget(attribute_name) # cget of CTkBaseClass
def bind(self, sequence=None, command=None, add=None):
def bind(self, sequence=None, command=None, add=True):
""" called on the tkinter.Entry """
return self._entry.bind(sequence, command, add)
if add != "+" or add is not True:
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._entry.bind(sequence, command, add=True)
def unbind(self, sequence, funcid=None):
""" called on the tkinter.Entry """
return self._entry.unbind(sequence, funcid)
if funcid is not None:
raise ValueError("'funcid' argument can only be None, because there is a bug in" +
" tkinter and its not clear whether the internal callbacks will be unbinded or not")
self._entry.unbind(sequence, None) # unbind all callbacks for sequence
self._create_bindings(sequence=sequence) # restore internal callbacks for sequence
def _activate_placeholder(self):
if self._entry.get() == "" and self._placeholder_text is not None and (self._textvariable is None or self._textvariable == ""):