Quickest way to print a png file or how do you print a wxmpl figure?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Quickest way to print a png file or how do you print a wxmpl figure?

Tim Burgess-2
Hi all,
I am struggling with printing from wxpython. Please dont refer me to the
wxpython wiki - been there done that.

I have two almost identical snippets of code to perform a print preview
and a paper print of a wxmpl figure. The print preview works
brilliantly, print to paper - nothing happens on the paper. A 0 byte
print job flashes through the windows print spooler and that's it.

For text reports I got easy html printing going - that was indeed
easy.... but I fought and fought with wxPrintout and gave up.... I had
exactly the same problem - print preview worked fine - but print paper -
empty print jobs.. I am missing something - but I dont know what. Please
not the wiki - it's not helping me - it normally is fantastic.

Can anyone post some code that will print a wxmpl figure? Here's mine -
it's in a state after several days of failed attempts....
               
                self.printer_config = wx.PrintData()
                print "Printer is: ",
self.printer_config.GetPrinterName()  # no printer name is reported here -
                                                                       
                            # yet a print job is sent to the pritner
               
self.printer_config.SetPaperId(wx.PAPER_A4_ROTATED)                
                tim = wxmpl.FigurePrinter(self,self.printer_config)
                tim.printFigure(self.ProdGraph.get_figure(), "Production
Schedule")

Plan B - my customer wants the graph on paper - he doesnt care how I do
it - and right now neither do I
I have wxmpl making a png image in a file - can some one give me the
minimum lines of code - to get the png on paper - please. Lets say the
file is called graph.png.

Thanks

--
Tim Burgess
IT Consultant
RedHat Certified Engineer
TBITC Pty Ltd
Professional Computer Support for Business
[hidden email]
Mobile 0422 942 972
Office 85 662 016
http://www.tbitc.com



Reply | Threaded
Open this post in threaded view
|

Re: [Matplotlib-users] Quickest way to print a png file or how do you print a wxmpl figure?

Alan G Isaac
On Sun, 27 Nov 2005, Tim Burgess apparently wrote:
> I am struggling with printing from wxpython. Please dont refer me to the
> wxpython wiki - been there done that.

> Plan B - my customer wants the graph on paper - he doesnt care how I do
> it - and right now neither do I
> I have wxmpl making a png image in a file - can some one give me the
> minimum lines of code - to get the png on paper - please. Lets say the
> file is called graph.png.

http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html

hth,
Alan Isaac






Reply | Threaded
Open this post in threaded view
|

Re: [Matplotlib-users] Quickest way to print a png file or how do you print a wxmpl figure?

Matt Newville
In reply to this post by Tim Burgess-2
Tim,

Does the example code at    http://cars9.uchicago.edu/~newville/Python/MPlot/
help at all?  I admit I haven't tried this on a linux box in a while,
and maybe not with very recent matplotlib versions.   But it works for
me on Windows and Mac, and has worked on linux boxes too.  The code
there should definitely be a reasonable place to start.

Cheers,

--Matt Newville <newville at cars.uchicago.edu>

On 11/26/05, Tim Burgess <[hidden email]> wrote:

> Hi all,
> I am struggling with printing from wxpython. Please dont refer me to the
> wxpython wiki - been there done that.
>
> I have two almost identical snippets of code to perform a print preview
> and a paper print of a wxmpl figure. The print preview works
> brilliantly, print to paper - nothing happens on the paper. A 0 byte
> print job flashes through the windows print spooler and that's it.
>
> For text reports I got easy html printing going - that was indeed
> easy.... but I fought and fought with wxPrintout and gave up.... I had
> exactly the same problem - print preview worked fine - but print paper -
> empty print jobs.. I am missing something - but I dont know what. Please
> not the wiki - it's not helping me - it normally is fantastic.
>
> Can anyone post some code that will print a wxmpl figure? Here's mine -
> it's in a state after several days of failed attempts....
>
>                 self.printer_config = wx.PrintData()
>                 print "Printer is: ",
> self.printer_config.GetPrinterName()  # no printer name is reported here -
>
>                             # yet a print job is sent to the pritner
>
> self.printer_config.SetPaperId(wx.PAPER_A4_ROTATED)
>                 tim = wxmpl.FigurePrinter(self,self.printer_config)
>                 tim.printFigure(self.ProdGraph.get_figure(), "Production
> Schedule")
>
> Plan B - my customer wants the graph on paper - he doesnt care how I do
> it - and right now neither do I
> I have wxmpl making a png image in a file - can some one give me the
> minimum lines of code - to get the png on paper - please. Lets say the
> file is called graph.png.
>
> Thanks
>
> --
> Tim Burgess
> IT Consultant
> RedHat Certified Engineer
> TBITC Pty Ltd
> Professional Computer Support for Business
> [hidden email]
> Mobile 0422 942 972
> Office 85 662 016
> http://www.tbitc.com
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


Reply | Threaded
Open this post in threaded view
|

Re: [Matplotlib-users] Quickest way to print a png file or how do you print a wxmpl figure?

Ken McIvor-2
In reply to this post by Tim Burgess-2
On Nov 26, 2005, at 11:13 PM, Tim Burgess wrote:
> Can anyone post some code that will print a wxmpl figure?

WxMpl already includes printing support, in the form of  
wxmpl.FigurePrinter.  Have you tried it yet, and if so, does it also  
have the zero-byte print job problem?

Ken