I’ve attached a little sample that shows a very strange issue I’m struggling with. I’m using python 3.7.8 and wxPython 4.1.1 on macOS Catalina and python 3.7.9 and wxPython 4.1.1 on WIndows 10.
If I create a sub-frame on macOS and drag that sub-frame to my other monitor, it loses its background color.
If I create a sub-dialog on macOS and drag that sub-dialog to my other monitor, it disappears. Poof! If I then create another sub-dialog, the first sub-dialog will pop up on the first monitor in the position it should have on the second monitor.
I do not experience this difficulty on Windows.
Anyone have any ideas for me? (I mean, other than “Don’t do that!”)
Thanks for the wx.EVT_SYS_COLOUR_CHANGED event tip.
I can confirm that neither problem occurs on macOS 10.14 Mojave.
Handling wx.EVT_SYS_COLOUR_CHANGED does the trick on macOS 10.15 Catalina. The sub-Dialog behavior is definitely different on Mojave and Catalina with the same wxPython version, 4.1.1, although I have different Python 3.7 versions on the two partitions.
On Catalina, the wx.EVT_SYS_COLOUR_CHANGED method doesn’t need to DO anything. If you bind the method and give it nothing but “pass”, the color change does not occur. Remove the event binding and the color will change when you move the Frame to the new monitor.
Karsten, what is unexpected is that program behavior is different if I don’t bind the method vs. if I do bind the method even if the method is empty. Robin’s original suggestion was to use the method to explicitly reset the color. But simply binding the method is sufficient even if the method does nothing. In fact, the empty method DOES do something, in that it prevents the color of the dialog from changing.
The sub-dialog reports itself as shown even when you can’t see it.
The position of the sub-dialog is influenced by the position of the parent. If you move the parent, the sub-dialog will move in parallel. This is true even if the sub-dialog has disappeared. You can use this to move a disappeared subdialog back onto the original monitor, where it will become invisible again. And if you move the parent onto the second monitor, the sub-dialog will move in parallel and will remain visible. In contrast, a sub-frame will maintain its own position when you move the parent.
And all of this is true only on macOS Catalina, not macOS Mojave or Windows.
I know this issue has dropped off the radar, which surprises me because my dialog boxes FREAKING DISAPPEAR whenever I move them to another monitor, often rendering my program frozen and forcing me to invoke Force Quit. It’s really quite an impossible situation. But for reasons that elude me, nobody else is talking about it.
I have determined that this issue appears to be limited to macOS Catalina, at least as demonstrated in my simple sample program. It does not occur on macOS 10.14 Mojave, nor on macOS 11.0 Big Sur, but it occurs perfectly reliably on macOS 10.15 Catalina. I need to see if it happens with wxPython’s Standard Dialog boxes like the MessageDialog() and FileDialog(), which I’ve unfortunately been too distracted to pursue. (I had a kid in the hospital.)