I am experiencing some focus problems that prevents the user from benefiting from keyboard shortcuts
without having the annoyance of constantly clicking on the wxPython Frame header to use them
My app currently uses wxPython 4.0, python 3.7, and the latest Panda3D 1.10.5 on windows 10
The problem shows up in a minimal example
Using python2 with Panda3D 1.10.5 shows the problem as well, while with Panda3D 1.9.4 I do not have the problem
I’m not sure if previous versions of Panda3D1.10 have this problem
The minimal example is posted here
Currently it seems Panda3D is controlling the MainLoop, since I call ShowBase.run() which calls wxApp.wxStep()
The problem
When I start the program, the wx.Frame is highlighted like I want, and clicking in the wxPandaWindow (under PUSH button) does not lose the highlighting… and also causes the Frame.FindFocus(…) to return the wxPandaWindow instance (ncore.ui.PandaPanel inherits from wxPandaWindow)
However, after I maximize and then restore the window, clicking in the wxPandaWindow causes Frame.FindFocus() to return None and the wx.Frame is not highlighted
I am still able to work with the contents of the wxPandaWindow
However, this then prevents the user from using keyboard shortcuts to interact with the wxPython UI.
As such the user has to click on the frame header to enable keyboard shortcuts, which is repetitive and annoying
I’ve noticed something interesting when I have the ncore.panel.MainWin object be maximized on startup (adding wx.MAXIMIZE to the style argument of wx.Frame.init)
In this case a second window appears
Question
My question then is, what kind of setting is changing when I maximize and then minimize?
Would it be worth it to convert it to have wxPython run the main loop? I’ve already tried that briefly, but ran into a problem with the variable base not being defined in Lib/site-packages/direct/wxwidgets/WxPandaWindow.py
In my real app, the problem happens immediately, with normal behavior happening for a split second after startup
focus_problem_py2.zip (26.7 KB) focus_problem_py3.zip (12.2 KB)
Thank you in advance for any suggestions