I have a MenuBar set up to catch Ctrl+c however this stops the SpinCtrl copy behaviour from working.
Testing with a TextCtrl works as expected. (the text is copied and the MenuBar event is not run)
I would expect that the events on the active UI element would take priority over the MenuBar items and at the very least this behaviour would be consistent.
I am using Windows 10 and wxPython 4.1.1
Here is some demo code that reproduces the issue.
import wx
class Frame(wx.Frame):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.create_menu()
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
self.text_ctrl = wx.TextCtrl(self) # copy works here
sizer.Add(self.text_ctrl)
self.spin_ctrl = wx.SpinCtrl(self) # copy does not work here
sizer.Add(self.spin_ctrl)
def create_menu(self):
menu_bar = wx.MenuBar()
menu = wx.Menu()
# commenting out the two lines below makes it work as expected
menu_item = menu.Append(wx.ID_ANY, "copy\tCtrl+c")
self.Bind(wx.EVT_MENU, self.copy, menu_item)
menu_bar.Append(menu, "edit")
self.SetMenuBar(menu_bar)
def copy(self, evt):
print("copy")
def main():
app = wx.App(0)
frame = Frame(None)
frame.Show()
app.MainLoop()
if __name__ == '__main__':
main()