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

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
timb@...847...
Mobile 0422 942 972
Office 85 662 016
http://www.tbitc.com

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

hth,
Alan 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.

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 <timb@...847...> 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
timb@...847...
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

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

···

On Nov 26, 2005, at 11:13 PM, Tim Burgess wrote:

Can anyone post some code that will print a wxmpl figure?