Skip to main content

Overview

The Trivial game generator creates educational trivia cards for the Operating Systems Implementation (ISO) course. It reads questions from an Excel spreadsheet and generates printable card sets for three evaluation periods.
The trivia game is designed as an engaging assessment tool for reviewing course material across different operating systems topics.

Project Structure

Trivial/
├── trivalize.py              # PNG-based card generator
├── trivialize_svg.py         # SVG-based card generator
├── TrivialISO.xlsx          # Questions database
├── crea-pdfs.sh             # PDF compilation script
├── limpiar.sh               # Cleanup script
├── dibujo_preguntas.svg     # Question card template
├── dibujo_respuesta_1.svg   # Answer template (Eval 1)
├── dibujo_respuesta_2.svg   # Answer template (Eval 2)
├── dibujo_respuesta_3.svg   # Answer template (Eval 3)
└── rsrc/
    ├── garamond.ttf         # Font for text rendering
    ├── Tux.svg              # Linux mascot
    └── Logos/               # OS logos (Windows, Linux, Debian)

Dependencies

Install required packages on Debian/Ubuntu systems:
sudo apt install librsvg2-bin pdftk python3-openpyxl python3-pil python3-reportlab

System Tools

  • librsvg2-bin (SVG rendering)
  • pdftk (PDF manipulation)

Python Packages

  • openpyxl (Excel reading)
  • PIL/Pillow (Image processing)
  • reportlab (PDF generation)

Generator Scripts

trivalize.py (PNG Generator)

Generates trivia cards as PNG images.

Features

  • Reads questions from TrivialISO.xlsx
  • Creates 30 cards per evaluation period (3 evaluations = 90 cards total)
  • Uses Garamond font at 11pt
  • Processes 6 categories per card
  • Validates question/answer length constraints

Key Configuration

numTarjetas = 30
trivial_path = "TrivialISO.xlsx"

# Card positions (width, height)
qbpos = [(64,27),(64,60),(64,93),(64,128),(64,163),(64,195)]
rbpos = [(190,27),(190,60),(190,93),(190,128),(190,163),(190,195)]

Validation Rules

Questions: Maximum 57 characters
  • Ensures text fits on card without wrapping
  • Triggers warning if exceeded
Answers: Maximum 29 characters
  • Maintains readability on answer side
  • Warnings printed for violations

Usage

./trivalize.py

Output Structure

Eva1Carta_1/
├── Eva1Carta_1_CARA_A.png  # Questions side
└── Eva1Carta_1_CARA_B.png  # Answers side

Eva1Carta_2/
├── Eva1Carta_2_CARA_A.png
└── Eva1Carta_2_CARA_B.png
...

trivialize_svg.py (SVG Generator)

Generates trivia cards as SVG files for higher quality and editability.

Advantages Over PNG Version

Scalability

Vector format allows infinite scaling without quality loss

Editability

SVG files can be edited in Inkscape or other vector graphics tools

Color Detection

Automatically detects category colors from sheet names

File Size

Smaller file sizes for storage and distribution

Usage

./trivialize_svg.py

Output Structure

Eva1Carta_1/
├── Eva1Carta_1_CARA_A.svg  # Questions side (editable)
└── Eva1Carta_1_CARA_B.svg  # Answers side (editable)

Excel Workbook Format

The TrivialISO.xlsx file organizes questions by category and evaluation period.

Sheet Naming Convention

<Color>_<Evaluation>
Example sheets:
  • Rojo_1 - Red category, Evaluation 1
  • Azul_1 - Blue category, Evaluation 1
  • Verde_2 - Green category, Evaluation 2
  • Amarillo_3 - Yellow category, Evaluation 3

Column Structure

Column AColumn B
QuestionAnswer
Each sheet should contain at least 30 rows of questions and answers.

Card Categories

The trivia game typically covers 6 categories aligned with course topics:

Installation

OS installation procedures and boot processes

Users & Permissions

User management, groups, and file permissions

File Systems

Storage, partitioning, and file system types

Networking

IP configuration, services, and protocols

Software

Package management and updates

Security

Firewalls, encryption, and security policies

Production Workflow

Step 1: Prepare Questions

Edit TrivialISO.xlsx with your course content:
  1. Create sheets for each category/evaluation combination
  2. Add questions (Column A) and answers (Column B)
  3. Keep questions under 57 characters
  4. Keep answers under 29 characters

Step 2: Generate Cards

Choose your preferred generator:
./trivalize.py

Step 3: Review Output

Check the terminal for any length warnings:
Hoja :Rojo_1 Fila: 15 -- Pregunta * : This question is too long and will be truncated
Hoja :Azul_1 Fila: 8 -- Respuesta * : This answer exceeds the limit

Step 4: Create PDFs

Use the included script to compile cards into PDFs:
./crea-pdfs.sh

Step 5: Print and Cut

  1. Print cards double-sided (front: questions, back: answers)
  2. Cut along card boundaries
  3. Optional: laminate for durability

Customization

Change Number of Cards

Edit the numTarjetas variable:
numTarjetas = 50  # Generate 50 cards per evaluation

Modify Text Positions

Adjust coordinate arrays for different card layouts:
# Questions positions (x, y)
qbpos = [(64,27), (64,60), (64,93), (64,128), (64,163), (64,195)]

# Answers positions (x, y)  
rbpos = [(190,27), (190,60), (190,93), (190,128), (190,163), (190,195)]

Change Font

Replace the font file and update the reference:
font = ImageFont.truetype("your-font.ttf", 11)

Cleanup

Remove generated card directories:
./limpiar.sh

Educational Value

The trivia game format offers several pedagogical benefits:

Active Recall

Students retrieve information from memory rather than passive review

Spaced Repetition

Three evaluation periods support distributed practice

Gamification

Game format increases engagement and motivation

Peer Learning

Cards can be used in group study sessions

Troubleshooting

Font Not Found

OSError: cannot open resource
Solution: Ensure garamond.ttf is in the Trivial/ directory or use a system font:
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 11)

Template Not Found

FileNotFoundError: dibujo_preguntas.svg
Solution: Run the script from the Trivial/ directory:
cd Trivial/
./trivialize_svg.py

Openpyxl Missing

ModuleNotFoundError: No module named 'openpyxl'
Solution: Install Python dependencies:
pip3 install openpyxl pillow reportlab

Build docs developers (and LLMs) love