Skip to content
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.
Artur Paiva edited this page Jul 30, 2014 · 12 revisions

cprint is a small python module that can print coloured text into a Unix console, userful for console logging and text-based applications.

Requirements

cprint has a few requirements, nothing that a majority of computers/devices cant handle.

  • Python version 2.5 or newest.¹
  • A Unix based (POSIX compliant) operating system.²
  • Linux, OS X, BSD, Solaris, among others.
  • A framebuffer compatible, 16 colors support console.³
  • Python's os and sys modules.

¹ Maybe cprint works with lower versions than 2.5, i couldnt risk since i never tested those versions, but, you can just catch the exception and try out (if possible, send me a feedback so i can adapt the code to work with older versions).

² Sorry about users of another operating systems, especially Windows. System's that aren't compliant with POSIX (specially Windows/DOS) don't have support for Unix escape characters, that is the main engine of this software.

³ There's no need for VESA, X or GUI. Any console that can display colors can run cprint, it also works with terminal emulators.

Usage

Just download a copy of cprint, paste the scripts inside your software's folder and import cprint.

  • If you're using Python 3, import cprint with the command: import c3print
  • If you're using Python 2, import cprint with the command: import cprint

You can also import all function of cprint inside your software, this is the recommended approach, since all commands starts with the letter c and for that, cant interfeer with the normal funcionalities of your software. Use from cprint import * to import the cprint functions directly. For Python 3 use from c3print import *.

Getting started

This wiki has all functionalities of cprint listed, but, you can start by the cprint function, that is the main functionality of cprint.