ARTICLE AD BOX
I made this type of input:
class PasteableEntry(tk.Entry): def __init__(self, master=None,initial_value:str="", **kwargs): super().__init__(master, **kwargs) self.initial_value = initial_value self.insert(tk.END, self.initial_value) # Clipboard bindings self.bind("<Control-c>", self.copy) self.bind("<Control-x>", self.cut) self.bind("<Control-v>", self.paste) # Undo binding self.bind("<Control-z>", self.reset_value) # Border self.configure(highlightthickness=2, highlightbackground="gray", highlightcolor="blue") # --- Clipboard overrides --- def copy(self, event=None): try: selection = self.selection_get() self.clipboard_clear() self.clipboard_append(selection) except tk.TclError: pass return "break" def cut(self, event=None): try: selection = self.selection_get() self.clipboard_clear() self.clipboard_append(selection) self.delete(self.index("sel.first"), self.index("sel.last")) except tk.TclError: pass return "break" def paste(self, event=None): try: text_to_paste = self.clipboard_get() try: sel_start = self.index("sel.first") sel_end = self.index("sel.last") self.delete(sel_start, sel_end) self.insert(sel_start, text_to_paste) except tk.TclError: self.insert(self.index(tk.INSERT), text_to_paste) except tk.TclError: pass return "break" # --- Undo --- def reset_value(self, event=None): try: self.delete(0, tk.END) self.insert(tk.END, self.initial_value) # built-in undo except tk.TclError: pass # nothing to undo return "break" class SpellCheckEntry(PasteableEntry): def __init__(self, master=None, **kwargs): super().__init__(master, **kwargs) def spellcheck(self)->bool: return TrueI want the method spellcheck to perform a spellcheck upon the Entry value. The SpellCheckEntry is used as a Whatsapp Template Button and may contain a mix of Greek and English.
The tool I build is a utility tool that allows me to version whatsapp templates and manage them.
What is the best approach to do this?
