Sending output to a printer

This is the place for queries that don't fit in any of the other categories.

Sending output to a printer

Postby effirlem » Wed Feb 13, 2013 8:31 pm

I have 'googled' everything that I can think of and still I have not found a way the send the output from a program to my printer. Can any one point me in the direction that I need to go to solve this?
effirlem
 
Posts: 2
Joined: Wed Feb 13, 2013 3:07 pm

Re: Sending output to a printer

Postby metulburr » Wed Feb 13, 2013 8:36 pm

There may be 3rd party modules for this purpose, but not sure. I have never attempted this, but might first idea would be to execute a shell command. In that case i would find out what the command is, and just execute with subprocess module.
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1122
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Sending output to a printer

Postby micseydel » Wed Feb 13, 2013 9:22 pm

This seems really basic although I've never done it, and apparently it's not so straightforward.

What OS are you using, and what exactly are you attempting to print? Simple text?

My guess is that using GUI (qt, wx, tk, etc.) module would support something like that. (Also, IDLE seems to have primitive printing, and it's written in tk, so it's definitely possible.)
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 940
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Sending output to a printer

Postby KevinD » Wed Feb 13, 2013 9:23 pm

I was looking for the same thing ages ago and could never find it.

Instead, I wound up writing my output to a text file. Since most of my programs are run by shell scripts, I just add a print command to my shell script after the program is completed. As an added bonus, I also have the option of reviewing the file before printing it, retrieving it after I invariably lose the printout, and even emailing the file instead of printing it.
Quanto lignum posset materiae materietur marmota Chuck si materiam possit materiari foedans, penitus lignum?
KevinD
 
Posts: 30
Joined: Fri Feb 08, 2013 3:15 am

Re: Sending output to a printer

Postby effirlem » Fri Feb 15, 2013 2:27 pm

Thanks for all the replies. I am taking an online course in Python, so I am just getting started in understanding it.
One of my sons approached me for a loan, so I got the idea to write a little program that would generate an list of payments, balances, etc. That was easy. Then I thought, send the output to the printer and give it to him. That is where I got stuck and now I see that this something that others have worked on before. I did take the advice of printing from IDLE, but that was just plain ugly. One of the up-coming lessons is about sending output to a file and then retrieving it. I will wait until I complete that lesson and then try to print something again.
Again thanks!!
effirlem
 
Posts: 2
Joined: Wed Feb 13, 2013 3:07 pm


Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 2 guests