GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Table of Contents
  • wx.Printer
  • Show Source
  • index
  • modules
  • next
  • previous
  • Home
  • Gallery
  • wx

This view

  • Original page
  • New address

GeezerVison is showing docs.wxpython.org — wx.Printer — wxPython 4.3.2 Docs

phoenix_title wx.Printer¶

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


class_hierarchy Class Hierarchy¶

Inheritance diagram for class Printer:

Inheritance diagram of Printer


method_summary Methods Summary¶

__init__

Constructor.

CreateAbortWindow

Creates the default printing abort window, with a cancel button.

GetAbort

Returns True if the user has aborted the print job.

GetLastError

Return last error.

GetPrintDialogData

Returns the print data associated with the printer object.

Print

Starts the printing process.

PrintDialog

Invokes the print dialog.

ReportError

Default error-reporting function.

Setup

Invokes the print setup dialog.


property_summary Properties Summary¶

Abort

See GetAbort

PrintDialogData

See GetPrintDialogData


api Class API¶

class wx.Printer(Object)¶

Possible constructors:

Printer(data=None) -> None

This class represents the Windows or PostScript printer, and is the vehicle through which printing may be launched by an application.


Methods¶

__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.

Parameters:

data (wx.PrintDialogData)

Return type:

None

See also

wx.PrintDialogData, wx.PrintData



CreateAbortWindow(self, parent, printout)¶

Creates the default printing abort window, with a cancel button.

Parameters:
  • parent (wx.Window)

  • printout (wx.Printout)

Return type:

wx.PrintAbortDialog



GetAbort(self)¶

Returns True if the user has aborted the print job.

Return type:

bool



static 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:

wx.PRINTER_NO_ERROR

No error happened.

wx.PRINTER_CANCELLED

The user cancelled printing.

wx.PRINTER_ERROR

There was an error during printing.


Return type:

wx.PrinterError



GetPrintDialogData(self)¶

Returns the print data associated with the printer object.

Return type:

wx.PrintDialogData



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.

Parameters:
  • parent (wx.Window)

  • printout (wx.Printout)

  • prompt (bool)

Return type:

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 nullptr is returned; call GetLastError to get detailed information about the kind of the error.

Parameters:

parent (wx.Window)

Return type:

wx.DC

Note

The application must delete this device context to avoid a memory leak.



ReportError(self, parent, printout, message)¶

Default error-reporting function.

Parameters:
  • parent (wx.Window)

  • printout (wx.Printout)

  • message (string)

Return type:

None



Setup(self, parent)¶

Invokes the print setup dialog.

Parameters:

parent (wx.Window)

Return type:

bool

Deprecated

The setup dialog is obsolete, though retained for backward compatibility.


Properties¶

Abort¶

See GetAbort



PrintDialogData¶

See GetPrintDialogData

© Copyright 2012-2026, The wxPython Team. Created using Sphinx 9.1.0 and the python-docs-theme.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.