********** wx.Printer ********** Inheritance diagram for `wx.Printer`: | .. inheritance-diagram:: wx.Printer | Description =========== 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. Derived From ^^^^^^^^^^^^^ * `wx.Object `_ See Also ^^^^^^^^ `wx.PrinterDC `_, `wx.PrintDialog `_, `wx.Printout `_, `wx.PrintPreview `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `CreateAbortWindow <#CreateAbortWindow>`_ * `GetAbort <#GetAbort>`_ * `GetLastError <#GetLastError>`_ * `GetPrintDialogData <#GetPrintDialogData>`_ * `Print <#Print>`_ * `PrintDialog <#PrintDialog>`_ * `ReportError <#ReportError>`_ * `Setup <#Setup>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Abort <#Abort>`_ * `PrintDialogData <#PrintDialogData>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(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. **Parameters:** * `data` (`wx.PrintDialogData `_) | **Returns:** `wx.Printer `_ -------- .. method:: CreateAbortWindow(parent, printout) Creates the default printing abort window, with a cancel button. **Parameters:** * `parent` (`wx.Window `_) * `printout` (`wx.Printout `_) -------- .. method:: GetAbort() Returns ``True`` if the user has aborted the print job. | **Returns:** `bool` -------- .. method:: GetLastError() Return last error. Valid after calling `Print <#Print>`_, `PrintDialog <#PrintDialog>`_ or `wx.PrintPreview.Print `_. These functions set last error to ``wx.PRINTER_NO_ERROR`` if no error happened. Returned value is one of the following: ================================== ======================================== Printer Error Flags Description ================================== ======================================== ``wx.PRINTER_NO_ERROR`` No error happened. ``wx.PRINTER_CANCELLED`` The user cancelled printing. ``wx.PRINTER_ERROR`` There was an error during printing. ================================== ======================================== | **Returns:** `int` -------- .. method:: GetPrintDialogData() Returns the print data associated with the printer object. | **Returns:** `wx.PrintDialogData `_ -------- .. method:: Print() 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 <#GetLastError>`_ to get detailed information about the kind of the error. | **Returns:** `bool` -------- .. method:: PrintDialog() 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 <#GetLastError>`_ to get detailed information about the kind of the error). The application must delete this device context to avoid a memory leak. | **Returns:** `wx.DC `_ -------- .. method:: ReportError(parent, printout, message) Default error-reporting function. **Parameters:** * `parent` (`wx.Window `_) * `printout` (`wx.Printout `_) * `message` (string) -------- .. method:: Setup(parent) Invokes the print setup dialog. Note that the setup dialog is obsolete from Windows 95, though retained for backward compatibility. **Parameters:** * `parent` (`wx.Window `_) | **Returns:** `bool` -------- Properties ^^^^^^^^^^ .. attribute:: Abort See `GetAbort <#GetAbort>`_ .. attribute:: PrintDialogData See `GetPrintDialogData <#GetPrintDialogData>`_