Hi all,
I would like to print from wxPython to a known printer destination.
I modified the example in "wxPython in Action" as follows:
def OnPrint(self, evt):
self.pdata.SetPrinterName (u"CUPS-PDF") # added fixed printer
destination
data = wx.PrintDialogData(self.pdata)
printer = wx.Printer(data)
text = self.tc.GetValue()
printout = TextDocPrintout(text, "title", self.margins)
useSetupDialog = False # no dialog needed
if not printer.Print(self, printout, useSetupDialog) \
and printer.GetLastError() == wx.PRINTER_ERROR:
wx.MessageBox(
"There was a problem printing.\n"
"Perhaps your current printer is not set correctly?",
"Printing Error", wx.OK)
else:
data = printer.GetPrintDialogData()
self.pdata = wx.PrintData(data.GetPrintData()) # force a
copy
printout.Destroy()
Unfortunately, wxPython is not using the selected printer.
Can you help?
Cheerio
Peter