wx python 3.0.2 classic 'CheckListBox' object has no attribute 'GetItemHeight'

42 views
Skip to first unread message

Mr&Mrs D

unread,
Jun 13, 2016, 8:05:39 PM6/13/16
to wxPython-users
Hi :)

Investigating porting my wx 2.8 python app to wx 3.0.2 classic (it's about time) and run into this hurdle. Apparently the GetItemHeight is not part of CheckListBox class anymore:

    bash\basher\patcher_dialog.py:519: wxPyDeprecationWarning: Accessing deprecated property.
      mouseItem = (event.m_y/self.gPatchers.GetItemHeight() +
    Traceback (most recent call last):
      File "bash\basher\patcher_dialog.py", line 519, in OnMouse
        mouseItem = (event.m_y/self.gPatchers.GetItemHeight() +
    AttributeError: 'CheckListBox' object has no attribute 'GetItemHeight'
  
People were using them to get the item hovered upon in a mouse event handler (gPatchers below is a `wx.CheckListBox`):

    def OnMouse(self,event):
        if event.Moving():
            mouseItem = (event.m_y/self.gPatchers.GetItemHeight() + # blows here
                self.gPatchers.GetScrollPos(wx.VERTICAL))
            if mouseItem != self.mouseItem:
                self.mouseItem = mouseItem
                self.MouseEnteredItem(mouseItem)
        elif event.Leaving():
            self.gTipText.SetLabel(self.defaultTipText)
            self.mouseItem = -1
        event.Skip()

So how do I achieve this in wx python 3.0.2 ?

(Asked at SO if anyone wants the points: http://stackoverflow.com/q/37788095/281545)

Mr&Mrs D

unread,
Jun 13, 2016, 8:05:40 PM6/13/16
to wxpytho...@googlegroups.com

Mr&Mrs D

unread,
Jun 14, 2016, 9:16:37 AM6/14/16
to wxPython-users
Sorry for double post - problem solved - see SO http://stackoverflow.com/a/37812316/281545

Still some insight as to why this was removed/if it is replaced would be welcome :)
Reply all
Reply to author
Forward
0 new messages