Pythonwin (Version 2 beta 3)

Neil Hodgson neilh at
Sat Feb 26 08:21:38 EST 2000

  I have fixed PythonWin source code printing to print the last page. The
file is located at:

\Program Files\Python\PythonWin\pywin\scintilla\

  You can download the fixed file from

   The problem is caused by having the last page in the starts array be
marked with the same value (length of document) that is also used as a
sentinel on the last page plus 1. When the sentinel is discovered, printing

   If you want to just patch the code, replace from line 507 which starts

if not pInfo.GetPreview()

to the end of the OnPrepareDC method with:

if not pInfo.GetPreview() and self.starts is not None:
    prevPage = pInfo.GetCurPage() - 1
    if prevPage > 0 and self.starts[prevPage] >= self.GetTextLength():
        # All finished.

(indenting as appropriate)

   A better approach in the code may be to choose a sentinel 1 greater than
any possible document index.


More information about the Python-list mailing list