Breaking into the industry: My journey to becoming a Software Engineer #6 — Flash Card Game

M E
3 min readJul 8, 2021
Front Side: French Word
Back Side: English Translation

I created a Flash Card using GUI Application — Tkinter and Pandas. I basically created this to practice my French. I’m always getting bit by travel bugs, and ever since high school, I have always wanted to learn how to speak French. So, why not create a flash card to help me learn a new language? Let’s do it!

Setting up the UI

Flash Card UI

First thing I did is to setup the User Interface of my flash card. I basically used a 2 x 2 grid (split the columns in two). Then I added the necessary widgets on the front side of the card such as the check and cross (wrong) buttons.

Generate the translation words

CSV file containing both French and English translation words
Function that generate random words from the CSV file.
Function that flips the card and displays the English translation word

I used PANDAS to read the csv file where I stored the different French and English translation words. Then, I created a function to generate random words from the csv file using the random function. The random French word that is being returned from the generate_random_word() function will be displayed on the screen. User have 3 seconds to guess what the English translation word is before the card is flipped to the back side. In order to achieve this 3 seconds delay, I used Tkinter’s “window.after()” function. If the user knows the correct English translation, the user must click the check button within 3 seconds before it flips to the back showing the correct answer. If the user does not know the correct translation, then the user must click the ‘X’ button or basically just wait until the card flips.

Correct Translation

When user clicks the check button, clicked_check() is called.
Checks if words_to_learn.csv exists, if not then the program will use the french_words.csv

When the user knows the correct English translation word and clicks on the check button, the clicked_check() function will be called because this particular function is passed as an argument in the check button’s command. When the clicked_check() function is called, the current random word (both French and English) will be removed from the original_data csv file. Then the updated csv data will be saved to a new csv file called words_to_learn.csv. So that the next time the program is run, it should check if words_to_learn.csv file exists. If it exists, the program should use those words to be displayed on the flashcards. If the words_to_learn.csv does not exist (i.e., the first time the program is run), then it should use the words in the french_words.csv (original_data).

Are you trying to learn a new language? Or studying for an exam? This Flash Card GUI App is handy!

*NOTE: You can change or add your own data by updating the CSV file.

Please check out the complete code of my Flash Card project on my GitHub. :)

--

--