EVT_KILL_FOCUS triggered twice on macOS
Charley Khan <[email protected]>
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
wxpython 4.1.0, installed from pypi, Python 3.8
Code below sets up two text controls, side by side.
Focus starts in the first one, click in the second one.
EVT_KILL_FOCUS bound to a handler for the first one should trigger as you
click on the second control and it takes focus from the first.
On Windows (7 and 10), it's only called once, as I'd expect.
On macOS 10.15.5: the editDone handler below is called *twice*.
Is this a bug? If so -- how do I tell if in wxPython or wxWidgets?
If not, what am I doing wrong? Suggestions appreciated!
thanks,
-ck
import logging
logging.basicConfig(level=logging.DEBUG)
import wx
import sys
logging.debug("python: %s", sys.version)
logging.debug("wx: %s", wx.__version__)
app = wx.App()
frame = wx.Frame(None)
sizer = wx.BoxSizer(wx.HORIZONTAL)
frame.SetSizer(sizer)
text = wx.TextCtrl(frame, style=wx.TE_MULTILINE)
text.SetValue("box 1 starts with focus")
sizer.Add(text, flag=wx.EXPAND, proportion=1)
text2 = wx.TextCtrl(frame, style=wx.TE_MULTILINE)
text2.SetValue("CLICK HERE to take the focus")
sizer.Add(text2, flag=wx.EXPAND, proportion=1)
def editDone(event):
logging.debug("editdone: %s", text.GetValue())
event.Skip()
text.Bind(wx.EVT_KILL_FOCUS, editDone)
frame.Show()
app.MainLoop()
--
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/536445a7-8623-4eda-bad1-0ab5d3bda068o%40googlegroups.com.