*************** wx.PrintPreview *************** Inheritance diagram for `wx.PrintPreview`: | .. inheritance-diagram:: wx.PrintPreview | Description =========== Objects of this class manage the print preview process. The object is passed a `wx.Printout `_ object, and the `wx.PrintPreview` object itself is passed to a `wx.PreviewFrame `_ object. Previewing is started by initializing and showing the preview frame. Unlike `wx.Printer.Print `_, flow of control returns to the application immediately after the frame is shown. .. seealso:: `wx.PrinterDC `_, `wx.PrintDialog `_, `wx.Printout `_, `wx.Printer `_, `wx.PreviewCanvas `_, `wx.PreviewControlBar `_, `wx.PreviewFrame `_. Derived From ^^^^^^^^^^^^^ * `wx.Object `_ Known Subclasses ^^^^^^^^^^^^^^^^ `wx.PyPrintPreview `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `AdjustScrollbars <#AdjustScrollbars>`_ * `DetermineScaling <#DetermineScaling>`_ * `DrawBlankPage <#DrawBlankPage>`_ * `GetCanvas <#GetCanvas>`_ * `GetCurrentPage <#GetCurrentPage>`_ * `GetFrame <#GetFrame>`_ * `GetMaxPage <#GetMaxPage>`_ * `GetMinPage <#GetMinPage>`_ * `GetPrintDialogData <#GetPrintDialogData>`_ * `GetPrintout <#GetPrintout>`_ * `GetPrintoutForPrinting <#GetPrintoutForPrinting>`_ * `GetZoom <#GetZoom>`_ * `IsOk <#IsOk>`_ * `PaintPage <#PaintPage>`_ * `Print <#Print>`_ * `RenderPage <#RenderPage>`_ * `SetCanvas <#SetCanvas>`_ * `SetCurrentPage <#SetCurrentPage>`_ * `SetFrame <#SetFrame>`_ * `SetOk <#SetOk>`_ * `SetPrintout <#SetPrintout>`_ * `SetZoom <#SetZoom>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Canvas <#Canvas>`_ * `CurrentPage <#CurrentPage>`_ * `Frame <#Frame>`_ * `MaxPage <#MaxPage>`_ * `MinPage <#MinPage>`_ * `PrintDialogData <#PrintDialogData>`_ * `Printout <#Printout>`_ * `PrintoutForPrinting <#PrintoutForPrinting>`_ * `Zoom <#Zoom>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(printout, printoutForPrinting, data=None) Constructor. Pass a printout object, an optional printout object to be used for actual printing, and the address of an optional block of printer data, which will be copied to the print preview object's print data. If `printoutForPrinting` is not ``None``, a ``Print...`` button will be placed on the preview frame so that the user can print directly from the preview interface. Do not explicitly delete the printout objects once this destructor has been called, since they will be deleted in the `wx.PrintPreview` constructor. The same does not apply to the data argument. Test the `IsOk <#IsOk>`_ member to check whether the `wx.PrintPreview` object was created correctly. `IsOk` could return ``False`` if there was a problem initializing the printer device context (current printer not set, for example). **Parameters:** * `printout` (`wx.Printout `_) * `printoutForPrinting` (`wx.Printout `_) * `data` (`wx.PrintDialogData `_) | **Returns:** `wx.PrintPreview `_ -------- .. method:: AdjustScrollbars(canvas) | **Parameters:** * `canvas` (`wx.PreviewCanvas `_) -------- .. method:: DetermineScaling() `No docstrings available for this method.` -------- .. method:: DrawBlankPage(canvas, dc) | **Parameters:** * `canvas` (`wx.PreviewCanvas `_) * `dc` (`wx.DC `_) | **Returns:** `bool` -------- .. method:: GetCanvas() Gets the preview window used for displaying the print preview image. | **Returns:** `wx.PreviewCanvas `_ -------- .. method:: GetCurrentPage() Gets the page currently being previewed. | **Returns:** `int` -------- .. method:: GetFrame() Gets the frame used for displaying the print preview canvas and control bar. | **Returns:** `wx.Frame `_ -------- .. method:: GetMaxPage() Returns the maximum page number. | **Returns:** `int` -------- .. method:: GetMinPage() Returns the minimum page number. | **Returns:** `int` -------- .. method:: GetPrintDialogData() `No docstrings available for this method.` -------- .. method:: GetPrintout() Gets the preview printout object associated with the `wx.PrintPreview` object. | **Returns:** `wx.Printout `_ -------- .. method:: GetPrintoutForPrinting() Gets the printout object to be used for printing from within the preview interface, or ``None`` if none exists. | **Returns:** `wx.Printout `_ -------- .. method:: GetZoom() `No docstrings available for this method.` -------- .. method:: IsOk() Returns ``True`` if the `wx.PrintPreview` is valid, ``False`` otherwise. It could return ``False`` if there was a problem initializing the printer device context (current printer not set, for example). | **Returns:** `bool` -------- .. method:: PaintPage(canvas, dc) This refreshes the preview window with the preview image. It must be called from the preview window's `OnPaint` member. The implementation simply blits the preview bitmap onto the canvas, creating a new preview bitmap if none exists. **Parameters:** * `canvas` (`wx.PreviewCanvas `_) * `dc` (`wx.DC `_) | **Returns:** `bool` -------- .. method:: Print(interactive) Invokes the print process using the second `wx.Printout `_ object supplied in the `wx.PrintPreview` constructor. Will normally be called by the **Print...** panel item on the preview frame's control bar. Returns ``False`` in case of error -- call `wx.Printer.GetLastError `_ to get detailed information about the kind of the error. **Parameters:** * `interactive` (bool) | **Returns:** `bool` -------- .. method:: RenderPage(pageNum) Renders a page into a `wx.MemoryDC `_. Used internally by `wx.PrintPreview`. **Parameters:** * `pageNum` (int) | **Returns:** `bool` -------- .. method:: SetCanvas(window) Sets the window to be used for displaying the print preview image. **Parameters:** * `window` (`wx.PreviewCanvas `_) -------- .. method:: SetCurrentPage(pageNum) Sets the current page to be previewed. **Parameters:** * `pageNum` (int) -------- .. method:: SetFrame(frame) Sets the frame to be used for displaying the print preview canvas and control bar. **Parameters:** * `frame` (`wx.Frame `_) -------- .. method:: SetOk(ok) | **Parameters:** * `ok` (bool) -------- .. method:: SetPrintout(printout) Associates a printout object with the `wx.PrintPreview` object. **Parameters:** * `printout` (`wx.Printout `_) -------- .. method:: SetZoom(percent) Sets the percentage preview zoom, and refreshes the preview canvas accordingly. **Parameters:** * `percent` (int) -------- Properties ^^^^^^^^^^ .. attribute:: Canvas See `GetCanvas <#GetCanvas>`_ and `SetCanvas <#SetCanvas>`_ .. attribute:: CurrentPage See `GetCurrentPage <#GetCurrentPage>`_ and `SetCurrentPage <#SetCurrentPage>`_ .. attribute:: Frame See `GetFrame <#GetFrame>`_ and `SetFrame <#SetFrame>`_ .. attribute:: MaxPage See `GetMaxPage <#GetMaxPage>`_ .. attribute:: MinPage See `GetMinPage <#GetMinPage>`_ .. attribute:: PrintDialogData See `GetPrintDialogData <#GetPrintDialogData>`_ .. attribute:: Printout See `GetPrintout <#GetPrintout>`_ and `SetPrintout <#SetPrintout>`_ .. attribute:: PrintoutForPrinting See `GetPrintoutForPrinting <#GetPrintoutForPrinting>`_ .. attribute:: Zoom See `GetZoom <#GetZoom>`_ and `SetZoom <#SetZoom>`_