Skip to main content

txtlib

Txtlib is a useful library to print text on the screen. It support basic text formatting. Just set area, text and format options!!!


Francesco Pasa
(frapa)
Txtlib is a small library (the download is only 2.5 Kb with a test script included) to render text. It's similar to Glyph and support almost the same features, but it use a different system.

Txtlib is developed to do a css editor.

How txtlib work

Txtlib is a module; you need only to import it and call the class Text. Txtlib does not draw anything on the screen, it only build an image calling the update() method. This allow you to have the maximum control on the screen. You have just to blit the text.area image where you want.

Txtlib doesn't store the format information in the same variable as text. This complicate the control of format, but make txtlib suitable to make a text editor with code highlighting. Anyway, it's available a method to convert HTML-like mark-up code into txtlib text format.

Features

  • Multi line text rendering
  • Basic text format (bold, italic and underline)
  • Different fonts in the same rendering area
  • Different font size
  • Different text colors
  • Automatic font loading (both system and custom fonts)
  • Background color and images
  • HTML-like syntax to define text format

changelog

Version 0.2 - Add html style markup
From this version you can define the style with simple html-like tags - see documentation for more informations.
Version 0.1.2 - Bugfixes
  • Txtlib doesn't crash any more if you try to load a font that does not exists. Now it load the default Pygame font.
  • Tab characters are now displayed.

TODO list (what txtlib doesn't support)

  • Lines splitting if the line is too long
  • Text scrolling
  • Line numbers
  • Clickable text
  • Documentation

Info

Please comment for any bug you find. If you find grammar errors in the text please inform me (I'm not very good at English).

Contact: francescopasa at gmail dot com

Links

Home Page
http://www.utopico.tk

Releases

txtlib 0.2 — 28 Jul, 2010

txtlib 0.1 — 24 Jul, 2010

txtlib 0.1.2 — 27 Jul, 2010

Pygame.org account Comments

  • Jacob Jenner Rasmussen 2012-11-14 07:57:09

    Download link broken!

  • Dan 2013-09-03 15:39:16

    Not quite sure what to do about a broken download link for 10 months. So I decided to create a Github repo for the library.

    If we can get a main supported fork that would be awesome but for the time being here it is: (https://github.com/ProfArithme...

  • Gary 2014-11-24 21:38:30

    Link to txtlib https://github.com/DanBradbury...