This class represents the Windows or PostScript printer, and is the vehicle through which printing may be launched by an application.
Printing can also be achieved through using of lower functions and classes, but this and associated classes provide a more convenient and general method of printing.
See also
Printing Framework Overview, wx.PrinterDC, wx.PrintDialog, wx.Printout, wx.PrintPreview
Constructor. |
|
Creates the default printing abort window, with a cancel button. |
|
Returns |
|
Return last error. |
|
Returns the print data associated with the printer object. |
|
Starts the printing process. |
|
Invokes the print dialog. |
|
Default error-reporting function. |
|
Invokes the print setup dialog. |
See |
|
wx.
Printer
(Object)¶Possible constructors:
Printer(data=None)
This class represents the Windows or PostScript printer, and is the vehicle through which printing may be launched by an application.
__init__
(self, data=None)¶Constructor.
Pass an optional pointer to a block of print dialog data, which will be copied to the printer object’s local data.
data (wx.PrintDialogData) –
See also
CreateAbortWindow
(self, parent, printout)¶Creates the default printing abort window, with a cancel button.
parent (wx.Window) –
printout (wx.Printout) –
GetAbort
(self)¶Returns True
if the user has aborted the print job.
bool
GetLastError
()¶Return last error.
Valid after calling Print
, wx.PrintDialog or wx.PrintPreview.Print
.
These functions set last error to PRINTER_NO_ERROR
if no error happened.
Returned value is one of the following:
|
No error happened. |
|
The user cancelled printing. |
|
There was an error during printing. |
GetPrintDialogData
(self)¶Returns the print data associated with the printer object.
Print
(self, parent, printout, prompt=True)¶Starts the printing process.
Provide a parent window, a user-defined wx.Printout object which controls the printing of a document, and whether the print dialog should be invoked first.
Print
could return False
if there was a problem initializing the printer device context (current printer not set, for example) or the user cancelled printing. Call GetLastError
to get detailed information about the kind of the error.
parent (wx.Window) –
printout (wx.Printout) –
prompt (bool) –
bool
PrintDialog
(self, parent)¶Invokes the print dialog.
If successful (the user did not press Cancel and no error occurred), a suitable device context will be returned; otherwise None
is returned; call GetLastError
to get detailed information about the kind of the error.
Note
The application must delete this device context to avoid a memory leak.
ReportError
(self, parent, printout, message)¶Default error-reporting function.
parent (wx.Window) –
printout (wx.Printout) –
message (string) –
Setup
(self, parent)¶Invokes the print setup dialog.
parent (wx.Window) –
bool
Deprecated
The setup dialog is obsolete, though retained for backward compatibility.
PrintDialogData
¶