wx.Frame style=wx.SIMPLE_BORDER doesn't work on wxPython 4.1.0

Hi there,
I have noticed that the frame style wx.SIMPLE_BORDER doesn’t work under wxPython 4.1.0 (X11). Instead of the window being either the size I set it to, or the size computed by the BoxSizer, the size is a 1x1 pixel window that is basically invisible.

I was using this style for my custom splash screen, but if I change it to wx.DEFAULT_FRAME_STYLE the problem goes away. If I try to change the size of the Frame with SetSize or SetClientSize nothing changes, unless I delay the call with wx.CallLater(5000) or similar.

Has anyone else encountered this?

Hamish

More specifically, it seems any window without wx.RESIZE_BOX has this issue. I can provide a minimal code sample if other people aren’t seeing this.

It’s working okay for me. (python -c "import wx; a=wx.App(); wx.Frame(None, style=wx.SIMPLE_BORDER).Show(); a.MainLoop()" on Ubuntu 18.04 with MATE desktop.)

Since it has to do with frame borders and sizing then it’s possible that your current WindowManager has something to do with it. They have varying levels of support for non-typical window features or options. Looking at your desktop environment’s options relating to window decorations, placement, etc. would be the first thing I would look at. Trying different WMs or DEs would be the next.

2 Likes

Thanks for the minimal snippet :slight_smile:

You’re right, this clearly isn’t as simple as I thought. It works for me on Cinnamon this way as well. I’ll do some more digging.

Okay, I’ve figured something out. The minimal file I’ve attached shows the issue:
If the SetClientSize() line is uncommented, the window is displayed at 1x1 pixel size, but if commented, it stays as 600x420.

Interestingly, I also get this issue with the minimal sample with wxPython 4.0.7, but I can confirm that making this simple change in my much larger full program fixes the issue. It only seems to happen when the SIMPLE_BORDER style is used - if unspecified/default, it always displays okay regardless on both version of wxPython. This is with both Cinnamon on Mint 20, and with XFCE on Parted Magic (based on Slackware), which is how I encountered the issue in the first place).

This wouldn’t be too much of an issue, except there are (or at least were) some issues on certain platforms when I didn’t also set the client size, and windows would appear with an unexpected size. This is all on X11 by the way, and (hopefully) not related to the X11/Wayland issue in wxWidgets that I mentioned before (which is confirmed but not yet fixed).

Can you reproduce this at your end?

Hamish

demo.py (895 Bytes)

Yes, I can duplicate the issue with this sample, however is only seems to happen if the size is the same passed in the wx.Frame.__init__ call. If I remove the size=(600, 420) parameter, or use a different size in SetClientSize then the bug is not triggered.

My guess is that there is some code somewhere in wxWidgets that is checking if the current size is the same as the newly requested size, and if so it does nothing. But, since at that point in time the window has not yet been mapped to the X11 display, then it ends up doing nothing then either, instead of setting the initial size like it would normally do.

Ah, interesting, and thanks for doing that.

Another one to report to the wxWidgets people you think?

Hamish

Yes, that would be a good idea.

Okay, started a thread at: https://forums.wxwidgets.org/viewtopic.php?f=29&t=47747