ScrolledThumbnail Error

Hi,

Using the ScrolledThumbnail widget, I am getting the following error when clicking on a thumbnail which is only partially shown (i.e., which we would need to scroll down or up to show completely).

Traceback (most recent call last):
  File "myproject\.venv\Lib\site-packages\wx\lib\agw\scrolledthumbnail.py", line 1817, in OnMouseDown
    self.ScrollToSelected()
  File "myproject\.venv\Lib\site-packages\wx\lib\agw\scrolledthumbnail.py", line 1540, in ScrollToSelected
    self.Scroll(x,sy)
TypeError: _ScrolledWindowBase.Scroll(): arguments did not match any overloaded call:
  overload 1: argument 2 has unexpected type 'float'
  overload 2: argument 1 has unexpected type 'int'

Here is the relevant code causing the error:

self.scrolledthumbnail.Bind(EVT_THUMBNAILS_SEL_CHANGED, self.OnSelectThumb)
    def OnSelectThumb(self, event):
        sel = self.thumbnail_scroller.GetSelection()
        wx.MessageBox(self.thumbnail_scroller.GetThumbInfo(sel))

Is this a bug? Is there any workaround?

Thanks

It’s likely that Scroll() is not expecting a floating point value. Easy to fix in the ScrolledThumbnail code, just round it to an integer and see if the error is gone - and if the behaviour is what you expect it to be.

Thank you for your input!

Currently I install wxpython using pip, is it possible and if yes what is the easiest way to switch to a local file that I can edit for ScrolledThumbnail only?

  1. Copy ScrolledThumbnail from wx.lib into your local folder
  2. Apply your edits
  3. Import ScrolledThumbnail from your local folder rather than wx.lib
  4. Once your edits are ok, consider providing a PR

Thank you for your kind explanation! Was able to fix following your steps. Rounding to an integer indeed fixed the issue.

Will look into how to do a PR.

Best,