This is weird. In almost all wxpython-based apps I have tried the keyboard makes windows trigger the “exclamation” sound.
Even the demo! If I open the simple button demo, click a button or the whitespace to get focus, then press any key I get the sound! This happens with every gui I make, regardless of machine or win10 version. It doesn’t happen if the gui is waiting for text input.
I discovered this as I was attempting to use hotkeys in an audio project, when extraneous noise is not welcome!
Well, yes, this is just as Windows works. It’s not specific of wxPython. Of course you can always suppress system sounds from the windows control panel.
From within a wxPython program, I wouldn’t know how to avoid it… on top of my mind, I may suggest to give the WANTS_CHARS style to the widget, and then just do nothing. Of course this will disable all keyboard navigation also… so you would have to re-wire navigation keys handling by yourself… at the very least, something like
As @ricpol suggests, this is a Windows thing. Specifically, it rings the bell when a widget that has the focus, but is not able to handle keyboard events, gets a keyboard event. Or something like that.
For an application hotkey you probably should be using a wx.AcceleratorTable. This works just like accelerators associated with a menu item (like Ctrl-O to open a file). In fact, when an accelerator key is pressed that is in the AcceleratorTable then you will get an EVT_MENU event just like you would have it is was a real menu item.