mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
fixed typo in all unbind methods
This commit is contained in:
parent
40474d6905
commit
8b85225133
@ -5,9 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
ToDo:
|
||||
- limit configuring attributes of overridden tk widgets (to be finished)
|
||||
- remove bg and background support for CTk and CTkToplevel (to be done)
|
||||
- optimize font attribute managing
|
||||
- enforce font size in pixel
|
||||
- enforce font to be tuple
|
||||
|
||||
|
@ -415,4 +415,4 @@ class CTkButton(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Canvas """
|
||||
return self._canvas.bind(sequence, funcid)
|
||||
return self._canvas.unbind(sequence, funcid)
|
||||
|
@ -370,4 +370,4 @@ class CTkCheckBox(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Canvas """
|
||||
return self._canvas.bind(sequence, funcid)
|
||||
return self._canvas.unbind(sequence, funcid)
|
||||
|
@ -356,4 +356,4 @@ class CTkComboBox(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Entry """
|
||||
return self._entry.bind(sequence, funcid)
|
||||
return self._entry.unbind(sequence, funcid)
|
||||
|
@ -70,7 +70,7 @@ class CTkEntry(CTkBaseClass):
|
||||
self._state = state
|
||||
self._textvariable_callback_name: str = ""
|
||||
|
||||
if not (self._textvariable is None or self._textvariable is ""):
|
||||
if not (self._textvariable is None or self._textvariable == ""):
|
||||
self._textvariable_callback_name = self._textvariable.trace_add("write", self._textvariable_callback)
|
||||
|
||||
self._canvas = CTkCanvas(master=self,
|
||||
@ -265,7 +265,7 @@ class CTkEntry(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Entry """
|
||||
return self._entry.bind(sequence, funcid)
|
||||
return self._entry.unbind(sequence, funcid)
|
||||
|
||||
def _activate_placeholder(self):
|
||||
if self._entry.get() == "" and self._placeholder_text is not None and (self._textvariable is None or self._textvariable == ""):
|
||||
|
@ -164,4 +164,4 @@ class CTkFrame(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Canvas """
|
||||
return self._canvas.bind(sequence, funcid)
|
||||
return self._canvas.unbind(sequence, funcid)
|
||||
|
@ -188,4 +188,4 @@ class CTkLabel(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Label """
|
||||
return self._text_label.bind(sequence, funcid)
|
||||
return self._text_label.unbind(sequence, funcid)
|
||||
|
@ -364,4 +364,4 @@ class CTkOptionMenu(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Label """
|
||||
return self._text_label.bind(sequence, funcid)
|
||||
return self._text_label.unbind(sequence, funcid)
|
||||
|
@ -289,4 +289,4 @@ class CTkProgressBar(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Canvas """
|
||||
return self._canvas.bind(sequence, funcid)
|
||||
return self._canvas.unbind(sequence, funcid)
|
||||
|
@ -332,4 +332,4 @@ class CTkRadioButton(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Canvas """
|
||||
return self._canvas.bind(sequence, funcid)
|
||||
return self._canvas.unbind(sequence, funcid)
|
||||
|
@ -256,4 +256,4 @@ class CTkScrollbar(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Canvas """
|
||||
return self._canvas.bind(sequence, funcid)
|
||||
return self._canvas.unbind(sequence, funcid)
|
||||
|
@ -372,4 +372,4 @@ class CTkSlider(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Canvas """
|
||||
return self._canvas.bind(sequence, funcid)
|
||||
return self._canvas.unbind(sequence, funcid)
|
||||
|
@ -381,4 +381,4 @@ class CTkSwitch(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Canvas """
|
||||
return self._canvas.bind(sequence, funcid)
|
||||
return self._canvas.unbind(sequence, funcid)
|
||||
|
@ -11,7 +11,7 @@ from .widget_helper_functions import pop_from_dict_by_set
|
||||
|
||||
class CTkTextbox(CTkBaseClass):
|
||||
"""
|
||||
Textbox with rounded corners, and all text features of tkinter Text widget.
|
||||
Textbox with rounded corners, and all text features of tkinter.Text widget.
|
||||
For detailed information check out the documentation.
|
||||
"""
|
||||
|
||||
@ -78,7 +78,9 @@ class CTkTextbox(CTkBaseClass):
|
||||
insertbackground=ThemeManager.single_color(self._text_color, self._appearance_mode),
|
||||
bg=ThemeManager.single_color(self._fg_color, self._appearance_mode),
|
||||
**pop_from_dict_by_set(kwargs, self._valid_tk_text_attributes))
|
||||
self._textbox.grid(row=0, column=0, padx=self._corner_radius, pady=self._corner_radius, rowspan=1, columnspan=1, sticky="nsew")
|
||||
self._textbox.grid(row=0, column=0, rowspan=1, columnspan=1, sticky="nsew",
|
||||
padx=self._apply_widget_scaling(self._corner_radius),
|
||||
pady=self._apply_widget_scaling(self._corner_radius))
|
||||
|
||||
self._check_kwargs_empty(kwargs, raise_error=True)
|
||||
|
||||
@ -89,6 +91,10 @@ class CTkTextbox(CTkBaseClass):
|
||||
super()._set_scaling(*args, **kwargs)
|
||||
|
||||
self._textbox.configure(font=self._apply_font_scaling(self._font))
|
||||
self._textbox.grid(row=0, column=0, rowspan=1, columnspan=1, sticky="nsew",
|
||||
padx=self._apply_widget_scaling(self._corner_radius),
|
||||
pady=self._apply_widget_scaling(self._corner_radius))
|
||||
|
||||
self._canvas.configure(width=self._apply_widget_scaling(self._desired_width),
|
||||
height=self._apply_widget_scaling(self._desired_height))
|
||||
self._draw()
|
||||
@ -143,8 +149,15 @@ class CTkTextbox(CTkBaseClass):
|
||||
self._border_color = kwargs.pop("border_color")
|
||||
require_redraw = True
|
||||
|
||||
if "text_color" in kwargs:
|
||||
self._text_color = kwargs.pop("text_color")
|
||||
require_redraw = True
|
||||
|
||||
if "corner_radius" in kwargs:
|
||||
self._corner_radius = kwargs.pop("corner_radius")
|
||||
self._textbox.grid(row=0, column=0, rowspan=1, columnspan=1, sticky="nsew",
|
||||
padx=self._apply_widget_scaling(self._corner_radius),
|
||||
pady=self._apply_widget_scaling(self._corner_radius))
|
||||
require_redraw = True
|
||||
|
||||
if "border_width" in kwargs:
|
||||
@ -161,9 +174,6 @@ class CTkTextbox(CTkBaseClass):
|
||||
self._font = kwargs.pop("font")
|
||||
self._textbox.configure(font=self._apply_font_scaling(self._font))
|
||||
|
||||
if "font" in kwargs:
|
||||
raise ValueError("No attribute named font. Use text_font instead of font for CTk widgets")
|
||||
|
||||
self._textbox.configure(**pop_from_dict_by_set(kwargs, self._valid_tk_text_attributes))
|
||||
super().configure(require_redraw=require_redraw, **kwargs)
|
||||
|
||||
@ -192,7 +202,14 @@ class CTkTextbox(CTkBaseClass):
|
||||
|
||||
def unbind(self, sequence, funcid=None):
|
||||
""" called on the tkinter.Text """
|
||||
return self._textbox.bind(sequence, funcid)
|
||||
return self._textbox.unbind(sequence, funcid)
|
||||
|
||||
def insert(self, index, text, tags=None):
|
||||
return self._textbox.insert(index, text, tags)
|
||||
|
||||
def get(self, index1, index2=None):
|
||||
return self._textbox.get(index1, index2)
|
||||
|
||||
|
||||
def yview(self, *args):
|
||||
return self._textbox.yview(*args)
|
||||
@ -200,9 +217,6 @@ class CTkTextbox(CTkBaseClass):
|
||||
def xview(self, *args):
|
||||
return self._textbox.xview(*args)
|
||||
|
||||
def insert(self, *args, **kwargs):
|
||||
return self._textbox.insert(*args, **kwargs)
|
||||
|
||||
def focus(self):
|
||||
return self._textbox.focus()
|
||||
|
||||
|
@ -142,6 +142,7 @@ class App(customtkinter.CTk):
|
||||
def sidebar_button_callback(self):
|
||||
print("sidebar_button click")
|
||||
self.entry.delete(0, tkinter.END)
|
||||
print(self.textbox.get("0.0", "end"))
|
||||
|
||||
def on_closing(self, event=0):
|
||||
self.destroy()
|
||||
|
Loading…
Reference in New Issue
Block a user