mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
Merge 613587db68
into d719950f80
This commit is contained in:
commit
e694d3bc84
@ -9,6 +9,7 @@ from .theme import ThemeManager
|
||||
from .core_rendering import DrawEngine
|
||||
from .core_widget_classes import CTkBaseClass
|
||||
from .font import CTkFont
|
||||
from .utility import pop_from_dict_by_set
|
||||
|
||||
|
||||
class CTkComboBox(CTkBaseClass):
|
||||
@ -17,6 +18,9 @@ class CTkComboBox(CTkBaseClass):
|
||||
For detailed information check out the documentation.
|
||||
"""
|
||||
|
||||
# attributes that are passed to and managed by the tkinter entry only:
|
||||
_valid_tk_entry_attributes = {"invalidcommand", "validate", "validatecommand"}
|
||||
|
||||
def __init__(self,
|
||||
master: any,
|
||||
width: int = 140,
|
||||
@ -100,7 +104,8 @@ class CTkComboBox(CTkBaseClass):
|
||||
bd=0,
|
||||
justify=justify,
|
||||
highlightthickness=0,
|
||||
font=self._apply_font_scaling(self._font))
|
||||
font=self._apply_font_scaling(self._font),
|
||||
**pop_from_dict_by_set(kwargs, self._valid_tk_entry_attributes))
|
||||
|
||||
self._create_grid()
|
||||
self._create_bindings()
|
||||
@ -295,6 +300,7 @@ class CTkComboBox(CTkBaseClass):
|
||||
if "justify" in kwargs:
|
||||
self._entry.configure(justify=kwargs.pop("justify"))
|
||||
|
||||
self._entry.configure(**pop_from_dict_by_set(kwargs, self._valid_tk_entry_attributes)) # configure Tkinter.Entry
|
||||
super().configure(require_redraw=require_redraw, **kwargs)
|
||||
|
||||
def cget(self, attribute_name: str) -> any:
|
||||
@ -338,6 +344,9 @@ class CTkComboBox(CTkBaseClass):
|
||||
return self._command
|
||||
elif attribute_name == "justify":
|
||||
return self._entry.cget("justify")
|
||||
|
||||
elif attribute_name in self._valid_tk_entry_attributes:
|
||||
return self._entry.cget(attribute_name) # cget of tkinter.Entry
|
||||
else:
|
||||
return super().cget(attribute_name)
|
||||
|
||||
@ -393,6 +402,9 @@ class CTkComboBox(CTkBaseClass):
|
||||
self._entry.delete(0, tkinter.END)
|
||||
self._entry.insert(0, value)
|
||||
|
||||
def delete(self, start, end):
|
||||
self._entry.delete(start, end)
|
||||
|
||||
def get(self) -> str:
|
||||
return self._entry.get()
|
||||
|
||||
|
@ -19,7 +19,7 @@ class CTkEntry(CTkBaseClass):
|
||||
|
||||
# attributes that are passed to and managed by the tkinter entry only:
|
||||
_valid_tk_entry_attributes = {"exportselection", "insertborderwidth", "insertofftime",
|
||||
"insertontime", "insertwidth", "justify", "selectborderwidth",
|
||||
"insertontime", "insertwidth", "invalidcommand", "justify", "selectborderwidth",
|
||||
"show", "takefocus", "validate", "validatecommand", "xscrollcommand"}
|
||||
|
||||
def __init__(self,
|
||||
|
@ -194,3 +194,7 @@ class CTkFrame(CTkBaseClass):
|
||||
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._canvas.unbind(sequence, None)
|
||||
|
||||
def event_generate(self, sequence, **kw):
|
||||
""" called on the tkinter.Canvas """
|
||||
self._canvas.event_generate(sequence, **kw)
|
||||
|
@ -281,6 +281,10 @@ class CTkLabel(CTkBaseClass):
|
||||
self._canvas.unbind(sequence, None)
|
||||
self._label.unbind(sequence, None)
|
||||
|
||||
def event_generate(self, sequence, **kw):
|
||||
""" called on the tkinter.Canvas """
|
||||
self._canvas.event_generate(sequence, **kw)
|
||||
|
||||
def focus(self):
|
||||
return self._label.focus()
|
||||
|
||||
|
@ -302,6 +302,10 @@ class CTkProgressBar(CTkBaseClass):
|
||||
" tkinter and its not clear whether the internal callbacks will be unbinded or not")
|
||||
self._canvas.unbind(sequence, None)
|
||||
|
||||
def event_generate(self, sequence, **kw):
|
||||
""" called on the tkinter.Canvas """
|
||||
self._canvas.event_generate(sequence, **kw)
|
||||
|
||||
def focus(self):
|
||||
return self._canvas.focus()
|
||||
|
||||
|
@ -271,6 +271,10 @@ class CTkScrollbar(CTkBaseClass):
|
||||
self._canvas.unbind(sequence, None) # unbind all callbacks for sequence
|
||||
self._create_bindings(sequence=sequence) # restore internal callbacks for sequence
|
||||
|
||||
def event_generate(self, sequence, **kw):
|
||||
""" called on the tkinter.Canvas """
|
||||
self._canvas.event_generate(sequence, **kw)
|
||||
|
||||
def focus(self):
|
||||
return self._canvas.focus()
|
||||
|
||||
|
@ -403,6 +403,10 @@ class CTkSlider(CTkBaseClass):
|
||||
self._canvas.unbind(sequence, None)
|
||||
self._create_bindings(sequence=sequence) # restore internal callbacks for sequence
|
||||
|
||||
def event_generate(self, sequence, **kw):
|
||||
""" called on the tkinter.Canvas """
|
||||
self._canvas.event_generate(sequence, **kw)
|
||||
|
||||
def focus(self):
|
||||
return self._canvas.focus()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user