DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

How I can perform spellcheck in a TkInter Entry:

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()

As I ask in question above I am looking for an apprkach on how I can spellcheck an tkInter entry. I am building a whatsappo template manager and I want to be able to spellcheck my inputs.

Can you reccomend me an approach?

Top comments (0)