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?
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.
we will be moving to on October 1 2016
more details here
User avatar
Posts: 2244
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.)
Due to the reasons discussed here we will be moving to on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 3000
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?
Posts: 29
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!!
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 6 guests