Skip to content

gamesbook/protograf

Repository files navigation

protograf

protograf

protograf is a utility written in Python for designing and creating simple, regular, graphical outputs in PDF (or PNG/GIF/SVG) format via a script.

protograf has been primarily created to handle the prototyping of cards, counters, tiles and boards for board games, including hexagonal grids, but can also be used for creating any simple design that has regular or repetitive elements; typically a mix of graphics and text.

You do not need to know the Python language to be able to use protograf but you do need Python installed on your machine!

📓 Documentation

The online documentation for protograf is available at Read the Docs; its highly recommended to read the sections in the order presented in the Guide.

If you're not familiar with any kind of programming or scripting, you should at least read some of the introductory sections, and especially the installation before proceeding...

🛠️ Requirements

protograf requires Python (version of 3.13 or higher) to be installed and running on your machine.

If this is not your current Python version, or Python is not installed on your machine, may want to install uv which is a cross-platform tool able to install Python.

If using uv, it is recommended to also create and use a virtual environment.

🧰 Quick Start (for the impatient)

Assuming that Python 3.13 or higher is installed on your machine, you can then install protograf via:

pip install protograf

or, if using uv:

uv pip install protograf

To check that protograf is working, you can use one (or more) of the files from any of the various examples sub-directories.

As a quick test, make a copy of example1.py script from the examples/manual directory. To do so, open the example1.py link in your browser, click on the Raw button (near the top right), and then save the web page as a file into a local directory on your machine.

Open a command-line window (also known as a terminal or a console), change to the directory where you saved the above file and type:

python example1.py

and press the Enter key.

This script is very simple - it just contains these lines:

# `example1` script for protograf
# Written by: Derek Hohls
# Created on: 29 February 2016
from protograf import *
Create()
Save()

and is designed to produce a single, blank, A4-sized page in a PDF file.

It should create an output file called example1.pdf, which will appear in the same directory as the script. You should be able to open and view this file using any PDF-capable program or application. (If you run the script in a Python shell, the output file will be called test.pdf.)

If this works, then download and try out other scripts from any of the examples sub-directories (note some examples may require additional files such as images, CSV files, or spreadsheets). You can download all the examples in a single ZIP file.

If it does not work, you may want to look at more detail provided in the installation guide.

🤝 Contributions

Please see the list of contributors.

🎲 Potential Features

These features are not guaranteed to be implemented; they just represent current / potential areas of work or idea development.

  • New Shapes:
    • Diamond shape
    • Parallelogram shape
    • Cross shape
    • Pod shape
  • Common objects:
    • CompassRose (replace Compass Shape)
    • Cube (Rhombus composite; "3D")
    • Domino (DotGrid inside Rectangle outline)
    • Die (Rectangle with DotGrid)
    • Meeple (Polyshape with Arcs)
    • Picture Frame (Trapezoid composite)
  • Hexagons: 18xx tile example (requires Arcs below!)
  • Hexagon Grid: better hexhex creation with notations
  • Polyline: define arcs along the path
  • Arcs (pathways) inside a hexagon (in progress)
  • Shortcut notation for styling of a Shape
  • Stripes: interior "areas" for a Rectangle
  • Cards:
    • support card-back designs
    • grid lines for hexagonal cards
    • multiple custom bleed areas
    • access to Google Sheets
    • extract rectangular cards as PNG files
    • page annotations
  • Color:
    • add support for CYMK

🧩 Potential Examples

These are possible examples to show board creation based on existing games:

  • Extra abstract game boards: Ludo, Wari, Mu Torere
  • Wargame board: Squad Leader with full terrain features (vector and bitmap)
  • Traveller board: show a fully-styled Star System
  • WarpWar board: show a fully-styled example
  • 18xx board: show a basic map with tracks, towns, cities and off-map areas

📣 Acknowledgements

The world is full of power and energy and a person can go far by just skimming off a tiny bit of it. "Snow Crash", Neal Stephenson, 1992.

As always, with Python, you are building "on the shoulders of giants". In this case, the pyMuPDF library provides all of the core infrastructure used to do the underlying graphics processing, PDF file creation and images exports; protograf is effectively a highly customised wrapper to simplify common uses around its existing and extensive capabilities.

Earlier versions of protograf used the ReportLab PDF Toolkit, which is also a very powerful library for supporting this type of application. Internal terminology, such as shapes, was developed before the adoption of pyMuPDF and it is coincidental that these are similar!

📚 Additional Libraries

📜 License

protograf is licensed under the GNU General Public License.

About

A Python library for designing and creating simple, regular, graphic output

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages