pdfViewer does not scroll

I'm using pdfViewer (in wxPython Phoenix  version 3.0.3.dev2323+9bcccff) and there is a bug that prevents the displayed PDF file from scrolling up or down.

There is a bug in the GoPage method of the pdfViewer class in viewer.py where it

does not call self.Render(). The code that reads:

if pagenum > 0 and pagenum <= self.numpages:
self.Scroll(0, pagenum*self.Ypagepixels/self.GetScrlPixelsPerUnit()[1])
else:
self.Scroll(0,0)
self.Render()

SHOULD BE:

if pagenum > 0 and pagenum <= self.numpages:
self.Scroll(0, pagenum*self.Ypagepixels/self.GetScrollPixelsPerUnit()[1])
else:
self.Scroll(0,0)

self.Render() # <-- Render() should be called outside the IF / ELSE block

(I don’t know the procedures for fixing the official source myself so am that since this change is so trivial someone else accustomed

to making such changes will take this on. Thanks)

        self.Render()            self.Scroll(0, 0)        else:            self.Render()            self.Scroll(0, z)            z = pagenum*y/x1            y = self.Ypagepixels            x1 = x[1]            x = self.GetScrollPixelsPerUnit()            """            self.Scroll(0, pagenum*self.Ypagepixels/self.GetScrollPixelsPerUnit()[1])            """     RAS        if pagenum > 0 and pagenum <= self.numpages:        """                :param integer `pagenum`: go to the provided page number if it is valid                Go to page        """    def GoPage(self, pagenum):

Check this SO question, I think it may help you solve the issue:

http://stackoverflow.com/questions/22881700/display-pdf-with-python-using-pdfviewer

···

On Sun, Jul 24, 2016 at 4:58 PM, bobattp@gmail.com wrote:

I'm using pdfViewer (in wxPython Phoenix  version 3.0.3.dev2323+9bcccff) and there is a bug that prevents the displayed PDF file from scrolling up or down.

There is a bug in the GoPage method of the pdfViewer class in viewer.py where it

does not call self.Render(). The code that reads:

if pagenum > 0 and pagenum <= self.numpages:
self.Scroll(0, pagenum*self.Ypagepixels/self.GetScrlPixelsPerUnit()[1])
else:
self.Scroll(0,0)
self.Render()

SHOULD BE:

if pagenum > 0 and pagenum <= self.numpages:
self.Scroll(0, pagenum*self.Ypagepixels/self.GetScrollPixelsPerUnit()[1])
else:
self.Scroll(0,0)

self.Render() # ← Render() should be called outside the IF / ELSE block

(I don’t know the procedures for fixing the official source myself so am that since this change is so trivial someone else accustomed

to making such changes will take this on. Thanks)

        self.Render()            self.Scroll(0, 0)        else:            self.Render()            self.Scroll(0, z)            z = pagenum*y/x1            y = self.Ypagepixels            x1 = x[1]            x = self.GetScrollPixelsPerUnit()            """            self.Scroll(0, pagenum*self.Ypagepixels/self.GetScrollPixelsPerUnit()[1])            """     RAS        if pagenum > 0 and pagenum <= self.numpages:        """                :param integer `pagenum`: go to the provided page number if it is valid                Go to page        """    def GoPage(self, pagenum):

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


If your need wx GUI assistance, checkout my gig on fiverr using the link below:-

https://www.fiverr.com/umaryusuf/develop-any-software-desktop-application-gui-in-python

Various changes to viewer.py have been made for Python 3 by different people and this alteration to the indentation appeared somewhere along the line. It was originally a wxCallAfter() and it was there as a belt and braces that seemed to be needed by Windows 8 which, for some reason, didn’t respect the main call to Render() that’s made in the OnScroll handler.

If you mean that the display doesn’t scroll in response to the corresponding buttons in the button bar, no it doesn’t at the moment. This is a Python 3 issue connected to the changes to integer division.

As the original author of pdfViewer, I am currently working through the changes needed to make things work under Phoenix with both Python 2 and 3. I’m in the process of testing everything under Windows and OS X and hope to issue a Pull Request soon asking Robin to commit the changes.

···

On Monday, 25 July 2016 04:15:29 UTC+1, bob...@gmail.com wrote:

I'm using pdfViewer (in wxPython Phoenix  version 3.0.3.dev2323+9bcccff) and there is a bug that prevents the displayed PDF file from scrolling up or down.

There is a bug in the GoPage method of the pdfViewer class in viewer.py where it

does not call self.Render(). The code that reads:

if pagenum > 0 and pagenum <= self.numpages:
self.Scroll(0, pagenum*self.Ypagepixels/self.GetScrlPixelsPerUnit()[1])
else:
self.Scroll(0,0)
self.Render()

SHOULD BE:

if pagenum > 0 and pagenum <= self.numpages:
self.Scroll(0, pagenum*self.Ypagepixels/self.GetScrollPixelsPerUnit()[1])
else:
self.Scroll(0,0)

self.Render() # ← Render() should be called outside the IF / ELSE block


Regards,
David Hughes
Forestfield Software