How to activate a window?

I have an application that creates two windows. The user can click a button in either to raise the other one which I do by calling wx.Window.Raise(). However, when the window is raised it is not activated, that is, it appears on top of the other, but does not get the focus. I’ve tried calling SetFocus() on it, but that has no effect. How can I give it the focus after I’ve raised it?

My understanding is that modern desktop environments consider self-activating without user intervention to be a security hole and do not generally allow it. Think about a self-activating window that pops up and intercepts your bank password in a way that the user is not likely to recognize that it happened. There are likely ways to work around that restriction, but wxWidgets doesn’t expose any functionality for that which I’m aware of.

Instead we have wx.TopLevelWindow.RequestUserAttention which will do whatever is normal on the platform for prompting the user that they should click on the window.