Search code examples
pythonpython-2.7wxpython

Additional Help When Mouse Hovering Over wx.MessageBox Or wx.MessageDialog


I am updating a piece of software that makes extensive use of wx.MessageBox and wx.MessageDialog. The functionality I want to add is that if a user hovers over either for a predefined period additional Help information appears, e.g. a copy of the relevant paragraph from the manual that the users tend not to read!

Thank you for any help...


Solution

  • I would use a wx.Timer that would pop up the additional help information. Then I would bind to wx.EVT_MOTION and reset the timeout of the wx.Timer object any time the mouse moves. If the user stops moving the mouse for the predetermined amount of time, the event handler that is bound to the timer object will be called and the pop up will appear.

    The only caveat that occurs to me is that the MessageBox (and possibly the MessageDialog) may not pay any attention to EVT_MOTION. You'll have to play around and see. If they don't work, replace them with the generic version or roll your own with a wx.Dialog.