[Tutor] putting accent on letters while user is typing in Entrybox (Tkinter)

Alan Gauld alan.gauld at yahoo.co.uk
Mon Jul 16 19:46:36 EDT 2018


On 16/07/18 18:29, Ali M wrote:
> The accents which i want to be automatically converted and put upon letters
> is circumflex and another one which shape is like the opposite of
> circumflex.

It doesn't really matter what the shapes are provided the result
is a unicode character.

You just want to substitute one character for another

>     def update_list(self):
>         search_term = self.search_var.get()

You have the string of characters here so you need to scan the string
and detect the special character pairs, do a look up and swap in the
unicode chars you want. I strongly suggest you do that in a method

def edit_input(self, input)
    for index,char in enumerate(input)
        ....
    return result

You can then proceed to process the new string as required.

          search_term = self.edit_input(search_term)
>         for item in self.listbox.get(0, tk.END):
>             if search_term.lower() in item:
>                 self.listbox.delete(0, tk.END)
>                 self.listbox.insert(tk.END, item)
>


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list