Windows 10 '!' sound on most wx apps

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!

Any ideas please?

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

class MainFrame(wx.Frame):
    def __init__(self, *a, **k):
        wx.Frame.__init__(self, *a, **k)
        p  = wx.Panel(self)
        self.b1 = wx.Button(p, pos=(10, 10), style=wx.WANTS_CHARS)
        b2 = wx.Button(p, pos=(10, 50))
        self.b1.Bind(wx.EVT_CHAR, self.onk)

    def onk(self, e): 
        e.Skip()
        self.b1.HandleAsNavigationKey(e)

but this will work only for the tab key, not the arrow keys.

But there may be other ways to do this.

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.

Thanks both.
Got it thanks, acceleratortable was just what I needed.