[wxPython] Bug in wxPython spin controls.

I seem to have a problem with a toolbar's tooltips somehow causing a spin event as if a spin control was invoked. Whenever I move the mouse cursor over the toolbar and a tooltip tries to pop up, the spin button's event is called. Additionally, the tooltip never appears.

from wxPython.wx import *

class MyApp(wxApp):
  def OnInit(self):
    frame = wxFrame(None, -1, "Toolbar bug")

    toolbar = frame.CreateToolBar(wxHORIZONTAL | wxNO_BORDER)
    toolbar.AddSimpleTool(100, wxNullBitmap, 'Tooltip')
    spinbutton = wxSpinButton(toolbar, 101, style = wxSP_VERTICAL)
    toolbar.AddControl(spinbutton)
    toolbar.Realize()

    EVT_SPIN(self, 101, self.OnSpin)
    
    frame.Show(true)
    return true

  def OnSpin(self, event):
    print event
    
MyApp().MainLoop()

I seem to have a problem with a toolbar's tooltips somehow causing
a spin event as if a spin control was invoked. Whenever I move the
mouse cursor over the toolbar and a tooltip tries to pop up, the
spin button's event is called. Additionally, the tooltip never
appears.

There is a bug there somewhere, but here is a partial solution. Change
EVT_SPIN (in wx.py) to look like this:

def EVT_SPIN(win, id, func):
    win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func)

EVT_SPIN_UP and EVT_SPIN_DOWN will still have the problem...

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxpython.org Java give you jitters?
http://wxpros.com Relax with wxPython!