Printing forms and labels in Python

Anssi Saari as at sci.fi
Sun Jun 13 14:12:52 EDT 2010


Monte Milanuk <memilanuk at gmail.com> writes:

> Hello,
>
> I'm still a relative newbie to python, so I apologize if this is
> covered in detail somewhere and I missed it.
>
> I have a program or two that I want to work on once I get more
> proficient with python and sqlite and tkinter/wxpython.  One of the
> big 'features' of those programs I want to make is going to be
> printing out match results (scores) from a competition along with
> competitor names and other pertinent information.  Currently most
> people are doing this in Excel, though there is one (old) DOS program
> written in BASIC that not only prints the match results and the
> reports for the sanctioning body, but also prints labels via a Dymo
> Label maker.

I actually looked into label printers recently. It seems that at least
the cheaper models from Brother and Dymo accept a bitmap in specific
dimensions and they print it pixel exactly. Very simple, in other
words. But different printers need different formats, which is why
there are printer drivers. I'd assume the DOS program you mention
supports a very specific Dymo printer?

Anyways, for operating systems using CUPS for printing (that would be
Mac OS X, Linux, *BSD at least), there seems to be pycups which wraps
the CUPS API.

>From a quick study of
http://timgolden.me.uk/python/win32_how_do_i/print.html, it looks like
in Windows you can just use the win32 APIs for printing, which is
hard. An easier alternative seems to be using PIL to generate a DIB
with your data in it and printing that.



More information about the Python-list mailing list