Skip to main content

FlashCardGenerator

FlashCardGenerator is a Python library for creating customizable flashcards in PDF format. It's designed to be easy to use while offering flexibility in flashcard design and layout.

Features

  • Create double-sided flashcards with customizable content
  • Support for additional information and an index on the front of the card
  • Markdown-style formatting (bold, italic, underline)
  • Automatic text wrapping and resizing to fit content
  • Configurable card layout (size, number per row, etc.)
  • PDF output for easy printing and sharing

Installation

To install FlashCardGenerator, run the following command:

pip install flashcard-generator

Quick Start

Here's a simple example to get you started:

from flashcard_generator import FlashCardGenerator

generator = FlashCardGenerator()
generator.set_filename("my_flashcards.pdf") \
         .add_entry("Bonjour", "Hello", extra="Casual greeting", index="1") \
         .add_entry("Merci", "Thank you", extra="**Important** phrase", index="2") \
         .add_entry("Au revoir", "Goodbye", extra="*Formal* farewell", index="3") \
         .generate()

This will create a PDF file named "my_flashcards.pdf" with three flashcards.

API Usage

Creating a FlashCardGenerator

generator = FlashCardGenerator()

Configuration Methods

  • set_filename(filename: str) -> Self: Set the output PDF filename
  • set_cards_per_row(count: int) -> Self: Set the number of cards per row
  • set_page_size(size: tuple) -> Self: Set the page size (default is A4)
  • set_margins(top: float, bottom: float, left: float, right: float) -> Self: Set page margins
  • set_card_height(height: float) -> Self: Set the height of each card

Adding Entries

generator.add_entry(original: str, translation: str, extra: str = "", index: str = "") -> Self
  • original: The text on the front of the card
  • translation: The text on the back of the card
  • extra: Additional information to display on the front (optional)
  • index: An index or identifier for the card, displayed in the bottom right corner (optional)

Generating the PDF

generator.generate()

This method creates the PDF file with all the added flashcards.

Markdown Formatting

You can use basic Markdown formatting in your flashcard text:

  • **bold** for bold text
  • *italic* for italic text
  • __underline__ for underlined text

Text Wrapping and Sizing

The FlashCardGenerator automatically wraps text that's too long to fit on a single line. If the wrapped text is still too large for the card, it will progressively reduce the font size to make the content fit.

Example

Here's a more detailed example showcasing various features:

from flashcard_generator import FlashCardGenerator
from reportlab.lib.units import cm

generator = FlashCardGenerator()
generator.set_filename("language_flashcards.pdf") \
         .set_cards_per_row(3) \
         .set_card_height(4*cm) \
         .add_entry("Bonjour", "Hello", extra="Casual greeting", index="1") \
         .add_entry("Merci beaucoup", "Thank you very much", extra="**Important** phrase for expressing gratitude", index="2") \
         .add_entry("Au revoir", "Goodbye", extra="*Formal* farewell", index="3") \
         .add_entry("S'il vous plaît", "Please", extra="__Polite__ request", index="4") \
         .add_entry("Comment allez-vous?", "How are you?", extra="Formal way to ask about someone's wellbeing", index="5") \
         .add_entry("Je ne comprends pas", "I don't understand", extra="Useful phrase when you're confused", index="6") \
         .generate()

This will create a PDF with 3 cards per row, each card 4 cm high, and include 6 flashcards with various formatting styles, extra information, and indices.

Contributing

Contributions to FlashCardGenerator are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for flashcard-generator 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flashcard-generator 0.1.1
File Size Uploaded Provenance Actions
flashcard_generator-0.1.1.tar.gz 6.9 kB Without provenance Details for flashcard_generator-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flashcard-generator 0.1.1
File Interpreter ABI Platform Actions
flashcard_generator-0.1.1-py3-none-any.whl Python 3 none any Details for flashcard_generator-0.1.1-py3-none-any.whl

Total release size: 13.6 kB

Release files / flashcard_generator-0.1.1.tar.gz

Download URL flashcard_generator-0.1.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0ebcf966e9c37e094e22d683139153b28eb248167ebde4ecb47e3e4ff6e7a292
BLAKE2b-256 checksum
How to use checksums
8714e6b97cdcb532cb968d319129a427ad0e4ece1253fb471a93c90a7d8fe987
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.8.19 Linux/6.1.0-25-amd64

Release files / flashcard_generator-0.1.1-py3-none-any.whl

Download URL flashcard_generator-0.1.1-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96ae675fa8c1bb634e4639bd4ef34f7d6728ca74789a98cf3223e39404e110b4
BLAKE2b-256 checksum
How to use checksums
f64f667e3d28189a68deb8a51741f8636c8bd08e5008473d77c069da458f80b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.8.19 Linux/6.1.0-25-amd64

Security for flashcard-generator 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page