French character display got corrupted after changing sequence of functions inside lambda using tk.button

27 Views Asked by At

Github : https://github.com/Cistress/Fr_En_Flashcard

As I was working on displaying French words in python, I noticed that the order of functions in lambda command in known_button (tkButton) would corrupt my codes to a point that some french characters would be literally unreadable (note that the problem did not exist before UNTIL i switched the order for testing purpose).

So I decided to put both functions under this new function called "def known_button_clicked()" and recreated a new words_to_learn.csv, the problem was then resolved

Does anyone know why that is? (I asked Gemini already, but I would also like to get some human answers.)

p.s I am very new to posting questions on Stack Overflow, so if there is any advice on better formatting or question structure, feel free to let me know :).

Original line of code:

known_button = Button(image = check_image, command= lambda : [next_card(),confirm_removal()])

To:

known_button = Button(image = check_image, command= lambda : [confirm_removal(), next_card()])

-> Problem described appeared

End result:

def known_button_clicked():
    confirm_removal()
    next_card()

    known_button = Button(image = check_image, command= known_button_clicked)

-> Problem resolved

0

There are 0 best solutions below