- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| flashsets | ||
| config.txt | ||
| flashcards.py | ||
| README.md | ||
| task.txt | ||
PFlashcards
A small, keyboard-driven flashcards program that runs in your terminal. Built
on the Python standard library's curses module, with zero external
dependencies.
Everything is a file: flashcard sets are plain-text .txt files, and
configuration is a plain-text config.txt.
Features
- Flashcard sets stored as easy-to-edit plain-text files in
flashsets/ - Animated card flip (horizontal or vertical) when you answer
- Number-key answer selection
- Sequential or shuffled study order
- Live progress and correct/wrong statistics
- End-of-session summary with restart option
- Set selection screen when no file is given
- Resize and small-terminal safe, restores your terminal on exit
Requirements
- Python 3 (uses only the standard library, including
curses) - A normal terminal (works over SSH)
Usage
Run the program with one of your flashcard sets:
python3 flashcards.py flashsets/python.txt
python3 flashcards.py --shuffle flashsets/linux.txt
Run it with no arguments to pick a set from a selection screen:
python3 flashcards.py
Controls
| Key | Action |
|---|---|
1-9 |
Select an answer |
N/Enter |
Next card |
B |
Previous card |
R |
Retry the current card |
S |
Shuffle the card order |
Q |
Quit |
Flashcard format
Each card is a numbered block with a question, two or more numbered answers, the correct answer number, and an optional explanation:
1 {
question: "What is the capital of France?"
answers: {
"1: London"
"2: Paris"
"3: Berlin"
"4: Madrid"
}
correct: 2
explanation: "Paris has been the French capital since the 12th century."
}
Blank lines and lines starting with # are ignored. Escape sequences allowed
inside quoted fields: \n, \t, \", \\.
Files are ordinary text, so they work with the usual Unix tools:
cat flashsets/python.txt
grep "chmod" flashsets/linux.txt
cp flashsets/linux.txt flashsets/linux-backup.txt
nvim flashsets/python.txt
Configuration
Behaviour can be tweaked in config.txt next to the program. Currently it
controls the flip animation:
animation: horizontal # card narrows to a vertical line, then widens again
animation: vertical # card shortens to a horizontal line, then grows again
Uncomment exactly one animation line. If none or more than one is set, the
program falls back to horizontal.