Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

Tip window not destroyed when mouse outside bounding rectangle

Open ibea84 opened this issue 3 years ago • 1 comments

Operating system: Windows 10 Pro wxPython version & source: wxpython-4.1.1 from pypi repo
Python version & source: Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24), via installer from python.org

Description of the problem: In the 4.1.1 version, the TipWIndow is not destroyed when moving the mouse out of a BoundingRect. This behavior is not observed in 4.1.0. Is this a bug or intended behaviour?

Example of multiple tip windows staying alive after moving mouse out of BoundingRect: image

Code Example (click to expand)
import wx


class RadioBoxFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1)
        panel = wx.Panel(self, -1, pos=(10, 10))
        sampleList = ['Zero', 'One', 'Two']
        self.option = wx.RadioBox(panel, -1, "Select an option", pos=(10, 10),
                                  size=wx.DefaultSize, choices=sampleList,
                                  majorDimension=3)
        self.Bind(wx.EVT_RADIOBOX, self.getOption)
        panel.Bind(wx.EVT_MOUSEWHEEL, self.getWheelOption)

        self.Show()

    def getWheelOption(self, event):
        whlRot = event.GetWheelRotation()
        if whlRot < 0:
            nxt = self.option.GetSelection() + 1
        else:
            nxt = self.option.GetSelection() - 1

        if nxt > self.option.GetCount() - 1:
            nxt = 0
        if nxt < 0:
            nxt = self.option.GetCount() - 1

        self.option.SetSelection(nxt)
        txt = "Option " + self.option.GetString(nxt) + " Selected"
        tw = wx.TipWindow(self, txt)
        tw.SetBoundingRect(wx.Rect(1, 1, 1, 1))

    def getOption(self, event):
        state1 = self.option.GetSelection()


if __name__ == '__main__':
    app = wx.App()
    RadioBoxFrame()
    app.MainLoop()

ibea84 avatar Feb 22 '22 17:02 ibea84

I am having the same issue

skilkis avatar Mar 11 '22 12:03 skilkis