2021-03-04 20:27:46 +03:00
|
|
|
import tkinter
|
2022-11-11 01:27:55 +03:00
|
|
|
from typing import Union, Tuple, Optional
|
2021-03-04 20:27:46 +03:00
|
|
|
|
2022-10-23 23:33:57 +03:00
|
|
|
from .core_rendering.ctk_canvas import CTkCanvas
|
2022-10-29 14:11:55 +03:00
|
|
|
from .theme.theme_manager import ThemeManager
|
2022-10-23 23:33:57 +03:00
|
|
|
from .core_rendering.draw_engine import DrawEngine
|
2022-10-29 01:42:33 +03:00
|
|
|
from .core_widget_classes.widget_base_class import CTkBaseClass
|
|
|
|
from .font.ctk_font import CTkFont
|
2021-03-04 20:27:46 +03:00
|
|
|
|
2022-10-16 21:13:19 +03:00
|
|
|
from customtkinter.utility.utility_functions import pop_from_dict_by_set, check_kwargs_empty
|
2022-10-03 01:33:06 +03:00
|
|
|
|
2021-03-04 20:27:46 +03:00
|
|
|
|
2022-04-20 23:50:57 +03:00
|
|
|
class CTkEntry(CTkBaseClass):
|
2022-10-02 04:23:10 +03:00
|
|
|
"""
|
|
|
|
Entry with rounded corners, border, textvariable support, focus and placeholder.
|
|
|
|
For detailed information check out the documentation.
|
|
|
|
"""
|
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
_minimum_x_padding = 6 # minimum padding between tkinter entry and frame border
|
|
|
|
|
2022-10-03 01:33:06 +03:00
|
|
|
# attributes that are passed to and managed by the tkinter entry only:
|
2022-10-04 00:50:59 +03:00
|
|
|
_valid_tk_entry_attributes = {"exportselection", "insertborderwidth", "insertofftime",
|
|
|
|
"insertontime", "insertwidth", "justify", "selectborderwidth",
|
|
|
|
"show", "takefocus", "validate", "validatecommand", "xscrollcommand"}
|
2022-10-03 01:33:06 +03:00
|
|
|
|
2022-10-06 16:53:52 +03:00
|
|
|
def __init__(self,
|
2022-11-11 01:27:55 +03:00
|
|
|
master: any,
|
2022-10-03 01:33:06 +03:00
|
|
|
width: int = 140,
|
|
|
|
height: int = 28,
|
2022-11-11 01:27:55 +03:00
|
|
|
corner_radius: Optional[int] = None,
|
|
|
|
border_width: Optional[int] = None,
|
|
|
|
|
|
|
|
bg_color: Union[str, Tuple[str, str]] = "transparent",
|
|
|
|
fg_color: Optional[Union[str, Tuple[str, str]]] = None,
|
|
|
|
border_color: Optional[Union[str, Tuple[str, str]]] = None,
|
|
|
|
text_color: Optional[Union[str, Tuple[str, str]]] = None,
|
|
|
|
placeholder_text_color: Optional[Union[str, Tuple[str, str]]] = None,
|
|
|
|
|
|
|
|
textvariable: Union[tkinter.Variable, None] = None,
|
|
|
|
placeholder_text: Union[str, None] = None,
|
|
|
|
font: Optional[Union[tuple, CTkFont]] = None,
|
2022-10-02 04:23:10 +03:00
|
|
|
state: str = tkinter.NORMAL,
|
2021-03-04 20:27:46 +03:00
|
|
|
**kwargs):
|
2022-01-07 22:54:45 +03:00
|
|
|
|
2022-10-03 01:33:06 +03:00
|
|
|
# transfer basic functionality (bg_color, size, appearance_mode, scaling) to CTkBaseClass
|
2022-10-06 16:53:52 +03:00
|
|
|
super().__init__(master=master, bg_color=bg_color, width=width, height=height)
|
2021-03-04 20:27:46 +03:00
|
|
|
|
2022-07-07 19:07:54 +03:00
|
|
|
# configure grid system (1x1)
|
2022-05-12 23:55:28 +03:00
|
|
|
self.grid_rowconfigure(0, weight=1)
|
|
|
|
self.grid_columnconfigure(0, weight=1)
|
2022-01-18 01:23:47 +03:00
|
|
|
|
2022-07-07 19:07:54 +03:00
|
|
|
# color
|
2022-11-11 01:27:55 +03:00
|
|
|
self._fg_color = ThemeManager.theme["color"]["entry"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
|
|
|
self._text_color = ThemeManager.theme["color"]["text"] if text_color is None else self._check_color_type(text_color)
|
|
|
|
self._placeholder_text_color = ThemeManager.theme["color"]["entry_placeholder_text"] if placeholder_text_color is None else self._check_color_type(placeholder_text_color)
|
|
|
|
self._border_color = ThemeManager.theme["color"]["entry_border"] if border_color is None else self._check_color_type(border_color)
|
2022-01-30 01:55:48 +03:00
|
|
|
|
2022-07-07 19:07:54 +03:00
|
|
|
# shape
|
2022-11-11 01:27:55 +03:00
|
|
|
self._corner_radius = ThemeManager.theme["shape"]["button_corner_radius"] if corner_radius is None else corner_radius
|
|
|
|
self._border_width = ThemeManager.theme["shape"]["entry_border_width"] if border_width is None else border_width
|
2022-07-07 19:07:54 +03:00
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
# text and state
|
2022-10-02 04:23:10 +03:00
|
|
|
self._is_focused: bool = True
|
|
|
|
self._placeholder_text = placeholder_text
|
|
|
|
self._placeholder_text_active = False
|
|
|
|
self._pre_placeholder_arguments = {} # some set arguments of the entry will be changed for placeholder and then set back
|
|
|
|
self._textvariable = textvariable
|
|
|
|
self._state = state
|
2022-10-04 00:50:59 +03:00
|
|
|
self._textvariable_callback_name: str = ""
|
|
|
|
|
2022-10-22 02:20:08 +03:00
|
|
|
# font
|
2022-11-11 01:27:55 +03:00
|
|
|
self._font = CTkFont() if font is None else self._check_font_type(font)
|
2022-10-22 02:20:08 +03:00
|
|
|
if isinstance(self._font, CTkFont):
|
|
|
|
self._font.add_size_configure_callback(self._update_font)
|
|
|
|
|
2022-10-04 04:16:59 +03:00
|
|
|
if not (self._textvariable is None or self._textvariable == ""):
|
2022-10-04 00:50:59 +03:00
|
|
|
self._textvariable_callback_name = self._textvariable.trace_add("write", self._textvariable_callback)
|
2022-10-02 04:23:10 +03:00
|
|
|
|
|
|
|
self._canvas = CTkCanvas(master=self,
|
|
|
|
highlightthickness=0,
|
|
|
|
width=self._apply_widget_scaling(self._current_width),
|
|
|
|
height=self._apply_widget_scaling(self._current_height))
|
|
|
|
self._draw_engine = DrawEngine(self._canvas)
|
|
|
|
|
|
|
|
self._entry = tkinter.Entry(master=self,
|
|
|
|
bd=0,
|
|
|
|
width=1,
|
|
|
|
highlightthickness=0,
|
2022-10-03 01:33:06 +03:00
|
|
|
font=self._apply_font_scaling(self._font),
|
2022-10-02 04:23:10 +03:00
|
|
|
state=self._state,
|
|
|
|
textvariable=self._textvariable,
|
2022-10-04 00:50:59 +03:00
|
|
|
**pop_from_dict_by_set(kwargs, self._valid_tk_entry_attributes))
|
2022-10-22 02:20:08 +03:00
|
|
|
|
|
|
|
self._create_grid()
|
2022-10-04 00:50:59 +03:00
|
|
|
|
2022-10-16 21:13:19 +03:00
|
|
|
check_kwargs_empty(kwargs, raise_error=True)
|
2022-10-02 04:23:10 +03:00
|
|
|
|
|
|
|
self._entry.bind('<FocusOut>', self._entry_focus_out)
|
|
|
|
self._entry.bind('<FocusIn>', self._entry_focus_in)
|
|
|
|
|
|
|
|
self._activate_placeholder()
|
|
|
|
self._draw()
|
|
|
|
|
2022-10-22 02:20:08 +03:00
|
|
|
def _create_grid(self):
|
|
|
|
self._canvas.grid(column=0, row=0, sticky="nswe")
|
|
|
|
|
|
|
|
if self._corner_radius >= self._minimum_x_padding:
|
|
|
|
self._entry.grid(column=0, row=0, sticky="nswe",
|
|
|
|
padx=min(self._apply_widget_scaling(self._corner_radius), round(self._apply_widget_scaling(self._current_height/2))),
|
|
|
|
pady=(self._apply_widget_scaling(self._border_width), self._apply_widget_scaling(self._border_width + 1)))
|
|
|
|
else:
|
|
|
|
self._entry.grid(column=0, row=0, sticky="nswe",
|
|
|
|
padx=self._apply_widget_scaling(self._minimum_x_padding),
|
|
|
|
pady=(self._apply_widget_scaling(self._border_width), self._apply_widget_scaling(self._border_width + 1)))
|
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
def _textvariable_callback(self, var_name, index, mode):
|
|
|
|
if self._textvariable.get() == "":
|
|
|
|
self._activate_placeholder()
|
|
|
|
|
2022-10-02 04:23:10 +03:00
|
|
|
def _set_scaling(self, *args, **kwargs):
|
|
|
|
super()._set_scaling(*args, **kwargs)
|
|
|
|
|
2022-10-03 01:33:06 +03:00
|
|
|
self._entry.configure(font=self._apply_font_scaling(self._font))
|
2022-10-02 04:23:10 +03:00
|
|
|
self._canvas.configure(width=self._apply_widget_scaling(self._desired_width), height=self._apply_widget_scaling(self._desired_height))
|
2022-10-22 02:20:08 +03:00
|
|
|
self._create_grid()
|
2022-10-15 02:02:54 +03:00
|
|
|
self._draw(no_color_updates=True)
|
2022-10-02 04:23:10 +03:00
|
|
|
|
|
|
|
def _set_dimensions(self, width=None, height=None):
|
|
|
|
super()._set_dimensions(width, height)
|
|
|
|
|
|
|
|
self._canvas.configure(width=self._apply_widget_scaling(self._desired_width),
|
|
|
|
height=self._apply_widget_scaling(self._desired_height))
|
|
|
|
self._draw()
|
|
|
|
|
2022-10-22 02:20:08 +03:00
|
|
|
def _update_font(self):
|
|
|
|
""" pass font to tkinter widgets with applied font scaling and update grid with workaround """
|
|
|
|
self._entry.configure(font=self._apply_font_scaling(self._font))
|
|
|
|
|
|
|
|
# Workaround to force grid to be resized when text changes size.
|
|
|
|
# Otherwise grid will lag and only resizes if other mouse action occurs.
|
|
|
|
self._canvas.grid_forget()
|
|
|
|
self._canvas.grid(column=0, row=0, sticky="nswe")
|
|
|
|
|
|
|
|
def destroy(self):
|
|
|
|
if isinstance(self._font, CTkFont):
|
|
|
|
self._font.remove_size_configure_callback(self._update_font)
|
|
|
|
|
|
|
|
super().destroy()
|
|
|
|
|
2022-10-02 04:23:10 +03:00
|
|
|
def _draw(self, no_color_updates=False):
|
2022-11-01 02:37:30 +03:00
|
|
|
super()._draw(no_color_updates)
|
|
|
|
|
2022-10-29 02:20:32 +03:00
|
|
|
self._canvas.configure(bg=self._apply_appearance_mode(self._bg_color))
|
2022-10-02 04:23:10 +03:00
|
|
|
|
|
|
|
requires_recoloring = self._draw_engine.draw_rounded_rect_with_border(self._apply_widget_scaling(self._current_width),
|
|
|
|
self._apply_widget_scaling(self._current_height),
|
|
|
|
self._apply_widget_scaling(self._corner_radius),
|
|
|
|
self._apply_widget_scaling(self._border_width))
|
2021-03-04 20:27:46 +03:00
|
|
|
|
2022-05-17 19:59:33 +03:00
|
|
|
if requires_recoloring or no_color_updates is False:
|
2022-11-11 01:27:55 +03:00
|
|
|
if self._apply_appearance_mode(self._fg_color) == "transparent":
|
2022-10-02 04:23:10 +03:00
|
|
|
self._canvas.itemconfig("inner_parts",
|
2022-10-29 02:20:32 +03:00
|
|
|
fill=self._apply_appearance_mode(self._bg_color),
|
|
|
|
outline=self._apply_appearance_mode(self._bg_color))
|
|
|
|
self._entry.configure(bg=self._apply_appearance_mode(self._bg_color),
|
|
|
|
disabledbackground=self._apply_appearance_mode(self._bg_color),
|
2022-11-11 15:06:26 +03:00
|
|
|
highlightcolor=self._apply_appearance_mode(self._bg_color))
|
2022-11-11 01:27:55 +03:00
|
|
|
else:
|
|
|
|
self._canvas.itemconfig("inner_parts",
|
|
|
|
fill=self._apply_appearance_mode(self._fg_color),
|
|
|
|
outline=self._apply_appearance_mode(self._fg_color))
|
|
|
|
self._entry.configure(bg=self._apply_appearance_mode(self._fg_color),
|
|
|
|
disabledbackground=self._apply_appearance_mode(self._fg_color),
|
2022-11-11 15:06:26 +03:00
|
|
|
highlightcolor=self._apply_appearance_mode(self._fg_color))
|
2022-10-02 04:23:10 +03:00
|
|
|
|
|
|
|
self._canvas.itemconfig("border_parts",
|
2022-10-29 02:20:32 +03:00
|
|
|
fill=self._apply_appearance_mode(self._border_color),
|
|
|
|
outline=self._apply_appearance_mode(self._border_color))
|
2022-10-02 04:23:10 +03:00
|
|
|
|
|
|
|
if self._placeholder_text_active:
|
2022-11-11 15:06:26 +03:00
|
|
|
self._entry.config(fg=self._apply_appearance_mode(self._placeholder_text_color),
|
|
|
|
disabledforeground=self._apply_appearance_mode(self._placeholder_text_color),
|
|
|
|
insertbackground=self._apply_appearance_mode(self._placeholder_text_color))
|
|
|
|
else:
|
|
|
|
self._entry.config(fg=self._apply_appearance_mode(self._text_color),
|
|
|
|
disabledforeground=self._apply_appearance_mode(self._text_color),
|
|
|
|
insertbackground=self._apply_appearance_mode(self._text_color))
|
2022-03-02 02:53:58 +03:00
|
|
|
|
2022-07-07 17:02:51 +03:00
|
|
|
def configure(self, require_redraw=False, **kwargs):
|
2022-05-22 20:45:42 +03:00
|
|
|
if "state" in kwargs:
|
2022-10-02 04:23:10 +03:00
|
|
|
self._state = kwargs.pop("state")
|
|
|
|
self._entry.configure(state=self._state)
|
2022-05-22 20:45:42 +03:00
|
|
|
|
2022-01-07 22:54:45 +03:00
|
|
|
if "fg_color" in kwargs:
|
2022-11-11 01:27:55 +03:00
|
|
|
self._fg_color = self._check_color_type(kwargs.pop("fg_color"))
|
2022-01-07 22:54:45 +03:00
|
|
|
require_redraw = True
|
|
|
|
|
|
|
|
if "text_color" in kwargs:
|
2022-11-11 01:27:55 +03:00
|
|
|
self._text_color = self._check_color_type(kwargs.pop("text_color"))
|
|
|
|
require_redraw = True
|
|
|
|
|
|
|
|
if "placeholder_text_color" in kwargs:
|
|
|
|
self._placeholder_text_color = self._check_color_type(kwargs.pop("placeholder_text_color"))
|
2022-01-07 22:54:45 +03:00
|
|
|
require_redraw = True
|
|
|
|
|
2022-05-12 23:55:28 +03:00
|
|
|
if "border_color" in kwargs:
|
2022-11-11 01:27:55 +03:00
|
|
|
self._border_color = self._check_color_type(kwargs.pop("border_color"))
|
2022-05-12 23:55:28 +03:00
|
|
|
require_redraw = True
|
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
if "border_width" in kwargs:
|
|
|
|
self._border_width = kwargs.pop("border_width")
|
2022-10-22 02:20:08 +03:00
|
|
|
self._create_grid()
|
2022-10-04 00:50:59 +03:00
|
|
|
require_redraw = True
|
|
|
|
|
2022-01-07 22:54:45 +03:00
|
|
|
if "corner_radius" in kwargs:
|
2022-10-02 04:23:10 +03:00
|
|
|
self._corner_radius = kwargs.pop("corner_radius")
|
2022-10-22 02:20:08 +03:00
|
|
|
self._create_grid()
|
2022-01-07 22:54:45 +03:00
|
|
|
require_redraw = True
|
|
|
|
|
2022-03-08 17:03:47 +03:00
|
|
|
if "placeholder_text" in kwargs:
|
2022-10-02 04:23:10 +03:00
|
|
|
self._placeholder_text = kwargs.pop("placeholder_text")
|
|
|
|
if self._placeholder_text_active:
|
|
|
|
self._entry.delete(0, tkinter.END)
|
|
|
|
self._entry.insert(0, self._placeholder_text)
|
2022-09-13 22:47:50 +03:00
|
|
|
else:
|
2022-10-02 04:23:10 +03:00
|
|
|
self._activate_placeholder()
|
2022-07-01 22:30:31 +03:00
|
|
|
|
2022-07-07 19:07:54 +03:00
|
|
|
if "textvariable" in kwargs:
|
2022-10-02 04:23:10 +03:00
|
|
|
self._textvariable = kwargs.pop("textvariable")
|
|
|
|
self._entry.configure(textvariable=self._textvariable)
|
2022-07-07 19:07:54 +03:00
|
|
|
|
2022-10-03 01:33:06 +03:00
|
|
|
if "font" in kwargs:
|
2022-10-22 02:20:08 +03:00
|
|
|
if isinstance(self._font, CTkFont):
|
|
|
|
self._font.remove_size_configure_callback(self._update_font)
|
|
|
|
self._font = self._check_font_type(kwargs.pop("font"))
|
|
|
|
if isinstance(self._font, CTkFont):
|
|
|
|
self._font.add_size_configure_callback(self._update_font)
|
|
|
|
|
|
|
|
self._update_font()
|
2022-08-16 15:05:15 +03:00
|
|
|
|
2022-07-01 22:30:31 +03:00
|
|
|
if "show" in kwargs:
|
2022-10-02 04:23:10 +03:00
|
|
|
if self._placeholder_text_active:
|
2022-10-04 00:50:59 +03:00
|
|
|
self._pre_placeholder_arguments["show"] = kwargs.pop("show") # remember show argument for when placeholder gets deactivated
|
2022-07-01 22:30:31 +03:00
|
|
|
else:
|
2022-10-02 04:23:10 +03:00
|
|
|
self._entry.configure(show=kwargs.pop("show"))
|
2022-03-08 17:03:47 +03:00
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
self._entry.configure(**pop_from_dict_by_set(kwargs, self._valid_tk_entry_attributes)) # configure Tkinter.Entry
|
|
|
|
super().configure(require_redraw=require_redraw, **kwargs) # configure CTkBaseClass
|
2022-10-03 01:33:06 +03:00
|
|
|
|
|
|
|
def cget(self, attribute_name: str) -> any:
|
|
|
|
if attribute_name == "corner_radius":
|
|
|
|
return self._corner_radius
|
|
|
|
elif attribute_name == "border_width":
|
|
|
|
return self._border_width
|
|
|
|
|
|
|
|
elif attribute_name == "fg_color":
|
|
|
|
return self._fg_color
|
|
|
|
elif attribute_name == "border_color":
|
|
|
|
return self._border_color
|
|
|
|
elif attribute_name == "text_color":
|
|
|
|
return self._text_color
|
|
|
|
elif attribute_name == "placeholder_text_color":
|
|
|
|
return self._placeholder_text_color
|
|
|
|
|
|
|
|
elif attribute_name == "textvariable":
|
|
|
|
return self._textvariable
|
|
|
|
elif attribute_name == "placeholder_text":
|
|
|
|
return self._placeholder_text
|
2022-10-04 00:50:59 +03:00
|
|
|
elif attribute_name == "font":
|
2022-10-03 01:33:06 +03:00
|
|
|
return self._font
|
|
|
|
elif attribute_name == "state":
|
|
|
|
return self._state
|
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
elif attribute_name in self._valid_tk_entry_attributes:
|
|
|
|
return self._entry.cget(attribute_name) # cget of tkinter.Entry
|
|
|
|
else:
|
2022-10-04 03:26:29 +03:00
|
|
|
return super().cget(attribute_name) # cget of CTkBaseClass
|
2022-01-07 22:54:45 +03:00
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
def bind(self, sequence=None, command=None, add=None):
|
2022-10-04 03:26:29 +03:00
|
|
|
""" called on the tkinter.Entry """
|
|
|
|
return self._entry.bind(sequence, command, add)
|
2022-10-02 04:59:54 +03:00
|
|
|
|
2022-10-04 04:03:43 +03:00
|
|
|
def unbind(self, sequence, funcid=None):
|
|
|
|
""" called on the tkinter.Entry """
|
2022-10-04 04:16:59 +03:00
|
|
|
return self._entry.unbind(sequence, funcid)
|
2022-10-04 04:03:43 +03:00
|
|
|
|
2022-10-02 04:23:10 +03:00
|
|
|
def _activate_placeholder(self):
|
|
|
|
if self._entry.get() == "" and self._placeholder_text is not None and (self._textvariable is None or self._textvariable == ""):
|
|
|
|
self._placeholder_text_active = True
|
2022-07-07 19:07:54 +03:00
|
|
|
|
2022-10-02 04:23:10 +03:00
|
|
|
self._pre_placeholder_arguments = {"show": self._entry.cget("show")}
|
2022-11-11 15:06:26 +03:00
|
|
|
self._entry.config(fg=self._apply_appearance_mode(self._placeholder_text_color),
|
|
|
|
disabledforeground=self._apply_appearance_mode(self._placeholder_text_color),
|
|
|
|
show="")
|
2022-10-02 04:23:10 +03:00
|
|
|
self._entry.delete(0, tkinter.END)
|
|
|
|
self._entry.insert(0, self._placeholder_text)
|
2022-07-01 22:30:31 +03:00
|
|
|
|
2022-10-02 04:23:10 +03:00
|
|
|
def _deactivate_placeholder(self):
|
|
|
|
if self._placeholder_text_active:
|
|
|
|
self._placeholder_text_active = False
|
2022-07-07 19:07:54 +03:00
|
|
|
|
2022-11-11 15:06:26 +03:00
|
|
|
self._entry.config(fg=self._apply_appearance_mode(self._text_color),
|
|
|
|
disabledforeground=self._apply_appearance_mode(self._text_color),)
|
2022-10-02 04:23:10 +03:00
|
|
|
self._entry.delete(0, tkinter.END)
|
|
|
|
for argument, value in self._pre_placeholder_arguments.items():
|
|
|
|
self._entry[argument] = value
|
2022-07-01 22:30:31 +03:00
|
|
|
|
2022-10-02 04:23:10 +03:00
|
|
|
def _entry_focus_out(self, event=None):
|
|
|
|
self._activate_placeholder()
|
|
|
|
self._is_focused = False
|
2022-07-01 22:30:31 +03:00
|
|
|
|
2022-10-02 04:23:10 +03:00
|
|
|
def _entry_focus_in(self, event=None):
|
|
|
|
self._deactivate_placeholder()
|
|
|
|
self._is_focused = True
|
2022-07-01 22:30:31 +03:00
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
def delete(self, first_index, last_index=None):
|
|
|
|
self._entry.delete(first_index, last_index)
|
2022-07-01 22:30:31 +03:00
|
|
|
|
2022-10-02 04:23:10 +03:00
|
|
|
if not self._is_focused and self._entry.get() == "":
|
|
|
|
self._activate_placeholder()
|
2022-01-07 22:54:45 +03:00
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
def insert(self, index, string):
|
2022-10-02 04:23:10 +03:00
|
|
|
self._deactivate_placeholder()
|
2022-07-01 22:30:31 +03:00
|
|
|
|
2022-10-04 00:50:59 +03:00
|
|
|
return self._entry.insert(index, string)
|
2022-01-07 22:54:45 +03:00
|
|
|
|
|
|
|
def get(self):
|
2022-10-02 04:23:10 +03:00
|
|
|
if self._placeholder_text_active:
|
2022-02-04 23:28:37 +03:00
|
|
|
return ""
|
|
|
|
else:
|
2022-10-02 04:23:10 +03:00
|
|
|
return self._entry.get()
|
2022-06-28 12:26:43 +03:00
|
|
|
|
|
|
|
def focus(self):
|
2022-10-04 00:50:59 +03:00
|
|
|
return self._entry.focus()
|
2022-06-28 12:26:43 +03:00
|
|
|
|
2022-10-05 22:11:46 +03:00
|
|
|
def focus_set(self):
|
|
|
|
return self._entry.focus_set()
|
|
|
|
|
2022-06-28 12:26:43 +03:00
|
|
|
def focus_force(self):
|
2022-10-04 00:50:59 +03:00
|
|
|
return self._entry.focus_force()
|
|
|
|
|
|
|
|
def index(self, index):
|
|
|
|
return self._entry.index(index)
|
|
|
|
|
|
|
|
def icursor(self, index):
|
|
|
|
return self._entry.icursor(index)
|
|
|
|
|
|
|
|
def select_adjust(self, index):
|
|
|
|
return self._entry.select_adjust(index)
|
|
|
|
|
|
|
|
def select_from(self, index):
|
|
|
|
return self._entry.icursor(index)
|
|
|
|
|
|
|
|
def select_clear(self):
|
|
|
|
return self._entry.select_clear()
|
|
|
|
|
|
|
|
def select_present(self):
|
|
|
|
return self._entry.select_present()
|
|
|
|
|
|
|
|
def select_range(self, start_index, end_index):
|
|
|
|
return self._entry.select_range(start_index, end_index)
|
|
|
|
|
|
|
|
def select_to(self, index):
|
|
|
|
return self._entry.select_to(index)
|
|
|
|
|
|
|
|
def xview(self, index):
|
|
|
|
return self._entry.xview(index)
|
|
|
|
|
|
|
|
def xview_moveto(self, f):
|
|
|
|
return self._entry.xview_moveto(f)
|
|
|
|
|
|
|
|
def xview_scroll(self, number, what):
|
|
|
|
return self._entry.xview_scroll(number, what)
|