Re: Class hierarchy for thumbnailctrl
Michael Eager <[email protected]>
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
On 9/5/20 10:31 PM, Andrea Gavana wrote: > Hi, > > On Sat, 5 Sep 2020 at 23.24, Michael Eager <[email protected] > <mailto:[email protected]>> wrote: > > I was looking at the example code for the thumbnailctrl class and > reading at the documentation so I could understand how to use it. > The class documentation is at > https://wxpython.org/Phoenix/docs/html/wx.lib.agw.thumbnailctrl.ThumbnailCtrl.html#wx.lib.agw.thumbnailctrl.ThumbnailCtrl > or https://wxpython.org/Phoenix/docs/html/wx.lib.agw.thumbnailctrl.html > > The two descriptions of the ThumbnailCtrl widget are different, > which is > confusing. More confusing is that many of the methods used in the > example were not listed in the class documentation. I found these > methods defined in the ScrolledThumbnailCtrl, but neither ThumbnailCtrl > or ScrolledThumbnail are in same inheritance tree. ThumbnailCtrl > inherits from Panel, while ScrolledThumbnailCtrl inherits from > ScrolledWindow. > > It was not clear when or how ScrolledThumbnailCtrl was supposed to be > used. (It now appears that it should not be used.) > > When I looked at the code for ThumbnailCtrl, I saw it contains an > instance of ScrolledThumbnailCtrl and that many of the latter's methods > are copied into the method list for ThumbnailCtrl. > > Can anyone explain why this is being done? It would seem cleaner (and > definitely more understandable) to have ThumbnailCtrl inherit from > ScrolledThumbnail and Panel. > > It’s been a long time since I’ve looked at the ThumbnailCtrl code, but I > don’t think there is any issue in changing the implementation so that > ThumbnailCtrl inherits from wx.Panel and ScrolledThumbnail. I agree it > would be much neater that way... > > If you can put together a pull request and see if things work correctly > I’m pretty sure Robin will consider it for merging. > > Andrea. OK, I'll think about this. There's a lot of Python (and wxPython) that I don't quite understand. I wondered if there was some reason why this pseudo-multiple inheritance trickery was being done. Maybe to selectively inherit some ScrolledThumbnailCtrl methods, but not others? -- Michael Eager -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/a64d3097-fca7-f5e2-9b97-efd18ab5ebc9%40eagercon.com.