Skip to content

Commit 01abee3

Browse files
author
Lenar Gasimov
committed
feat: added complete day 31
Built a language learning Flash Card App Capstone Project with Tkinter and Pandas. A project that translates frequently spoken English computer science words to Russian.
1 parent efc5aa2 commit 01abee3

10 files changed

+121
-8
lines changed

Diff for: README.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
# 100 Days of Python 🐍
22

3-
![https://badgen.net/badge/github/commits/grey?icon=github](https://badgen.net/badge/github/commits/grey?icon=github)
4-
53
![wallpaper](wallpaper.png)
64

7-
Im taking part in '100 Days of Code - The Complete Python Pro Bootcamp for 2021' course from Udemy.
8-
5+
Im taking part in "100 Days of Code - The Complete Python Pro Bootcamp for 2021" course from Udemy.
96
Since my goal is to master Python, I chose to take this course in the hope it would provide more structure and better
107
guidance than I was getting while "self-learning".
11-
128
While taking part in this course, I have been taking notes and what-not and attempting all of the course projects to the
139
best of my abilities.
14-
1510
I'll be using this repo as a way for myself to access them as, if and when I need them.
16-
17-
100 projects in 100 days. All the personal projects for Great professor and great course, really recommend it. <br>
11+
100 projects in 100 days. All the personal projects for Great professor and great course, really recommend it:
1812
[100 Days of Code - The Complete Python Pro Bootcamp for 2021](https://www.udemy.com/course/100-days-of-code).
1913

2014
## 👨🏻‍🎓 Beginner
@@ -50,6 +44,7 @@ I'll be using this repo as a way for myself to access them as, if and when I nee
5044
- [Day 28](day28): Tkinter, Dynamic Typing and the Pomodoro GUI Application
5145
- [Day 29](day29): Building a Password Manager GUI App with Tkinter
5246
- [Day 30](day30): Errors, Exceptions and JSON Data: Improving the Password Manager
47+
- [Day 31](day31): Day 31 - Capstone Project - Flash Card App
5348

5449
<p align="center">
5550
<img width="360" src="cat.gif" alt="profile" />

Diff for: day31/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Day 31
2+
3+
Built a language learning Flash Card App Capstone Project with Tkinter and Pandas.
4+
A project that translates frequently spoken English computer science words to Russian.
5+
6+
## Flash Card App
7+
8+
![flash card](flash_card.gif)

Diff for: day31/data/computer_scince_words.csv

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
English,Russian
2+
abort,аварийное прекращение работы
3+
adress,адрес
4+
algorithm,алгоритм
5+
analog,аналог
6+
anchor,якорь
7+
array,массив
8+
ASCII,ASCII
9+
asterisk,звездочка
10+
audiobook,аудиокнига
11+
avatar,аватар
12+
background,фон
13+
backspace,клавиша Backspace
14+
backup,резервная копия
15+
bandwidth,полоса пропускания
16+
banner,баннер
17+
binary,бинарный
18+
bit,бит
19+
bitmap,растр
20+
blackberry,ежевика
21+
blog,блог
22+
blogosphere,блогосфера
23+
browser,браузер
24+
browsing,просмотр
25+
buffer,буфер
26+
bug,баг

Diff for: day31/data/words_to_learn.csv

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
English,Russian
2+
abort,аварийное прекращение работы
3+
adress,адрес
4+
algorithm,алгоритм
5+
anchor,якорь
6+
array,массив
7+
background,фон
8+
backspace,клавиша Backspace
9+
bandwidth,полоса пропускания
10+
bit,бит
11+
blog,блог
12+
browser,браузер
13+
bug,баг

Diff for: day31/flash_card.gif

2.17 MB
Loading

Diff for: day31/images/card_back.png

14.2 KB
Loading

Diff for: day31/images/card_front.png

14.5 KB
Loading

Diff for: day31/images/right.png

8.72 KB
Loading

Diff for: day31/images/wrong.png

10.2 KB
Loading

Diff for: day31/main.py

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
from tkinter import *
2+
import pandas
3+
import random
4+
5+
BACKGROUND_COLOR = "#B1DDC6"
6+
current_card = {}
7+
to_learn = {}
8+
9+
try:
10+
data = pandas.read_csv("data/words_to_learn.csv")
11+
except FileNotFoundError:
12+
original_data = pandas.read_csv("data/computer_scince_words.csv")
13+
print(original_data)
14+
to_learn = original_data.to_dict(orient="records")
15+
else:
16+
to_learn = data.to_dict(orient="records")
17+
18+
19+
def next_card():
20+
global current_card, flip_timer
21+
window.after_cancel(flip_timer)
22+
current_card = random.choice(to_learn)
23+
canvas.itemconfig(card_title, text="English", fill="black")
24+
canvas.itemconfig(card_word, text=current_card["English"], fill="black")
25+
canvas.itemconfig(card_background, image=card_front_img)
26+
flip_timer = window.after(3000, func=flip_card)
27+
28+
29+
def flip_card():
30+
canvas.itemconfig(card_title, text="Russian", fill="white")
31+
canvas.itemconfig(card_word, text=current_card["Russian"], fill="white")
32+
canvas.itemconfig(card_background, image=card_back_img)
33+
34+
35+
def is_known():
36+
to_learn.remove(current_card)
37+
print(len(to_learn))
38+
data = pandas.DataFrame(to_learn)
39+
data.to_csv("data/words_to_learn.csv", index=False)
40+
next_card()
41+
42+
43+
window = Tk()
44+
window.title("Flashy")
45+
window.config(padx=50, pady=50, bg=BACKGROUND_COLOR)
46+
47+
flip_timer = window.after(3000, func=flip_card)
48+
49+
canvas = Canvas(width=800, height=526)
50+
card_front_img = PhotoImage(file="images/card_front.png")
51+
card_back_img = PhotoImage(file="images/card_back.png")
52+
card_background = canvas.create_image(400, 263, image=card_front_img)
53+
card_title = canvas.create_text(400, 150, text="", font=("Ariel", 40, "italic"))
54+
card_word = canvas.create_text(400, 263, text="", font=("Ariel", 60, "bold"))
55+
canvas.config(bg=BACKGROUND_COLOR, highlightthickness=0)
56+
canvas.grid(row=0, column=0, columnspan=2)
57+
58+
cross_image = PhotoImage(file="images/wrong.png")
59+
unknown_button = Button(image=cross_image, highlightthickness=0, command=next_card)
60+
unknown_button.grid(row=1, column=0)
61+
62+
check_image = PhotoImage(file="images/right.png")
63+
known_button = Button(image=check_image, highlightthickness=0, command=is_known)
64+
known_button.grid(row=1, column=1)
65+
66+
next_card()
67+
68+
window.mainloop()
69+
70+
71+

0 commit comments

Comments
 (0)