DO NOT PANIC ! If you're an end user... If you're the developer

Sir:

While running a wxpython program, following message pops out three times.

DO NOT PANIC !!

If you're an end user running ... it is harmless...

If you're the developer, simply remove this flag from your code to avoid getting this message.

Problem is that it is not “it is not harmless” in that new dialog window is too small (height not enough, width may be OK) and buttons and checkboxes are squashed (overlaying each other),

I also edited the python code for this message not to show up, (simply followed the instruction), but the problem still exists.

I played around with several other wx.ALIGN flags, but no success, so far.

My system is Debian AMD 64, both python9 and python11 are checked. This code used to work several years ago, (I do not remember python version)

Can anybody direct me to next step? I appreciate any hints.

The sizer warnings are probably unrelated to the problems you’re encountering. Do you have a small, self-contained example program that shows the problem?

swt2c

Thank you for your suggestion.

I unfortunately do not have a small sample code. This sizer has a lot of components, (many *.py files) But I will try.

One thing I want to mention is that:
With two other windows (sizers), I ran into similar situation, (sizer waring and squashed contents). Things went fine, once sizer warnings were taken care of.

I will check these sizers also, to reproduce my problem.

cheers

Sir:

After a long interval… I have narrowed down where problem is. The code to blame is probably
Fit(self)

This code used to work a while ago. Is there any recent change about this function?

By the way, following is summary of the problematic code. Problem happens when checkBox is set to shortVersion, When checkBox is set to longVersion, no problem,

class preW(wx.Dialog):
    def __init__(self, .....):
     .
    (prepare many sizers and contents. 
      checkbox for full and short versions)
     .
    sizer_1.Fit(self)    
     .

    def longVersionSetup(self):
     .

    def shortVersionSetup(self):

cheers

Sir

I have further narrowed down. It looks like that problem is related to dialog size. I will extract the simplest code set and start a new thread.

Thank you.

I changed my mind not to start new thread. Following is a rough sketch of the problematic code. When self.Layout() is at RED position, dialog is small and things go squashed, at BLUE, no trouble, dialog is big enough.

Its code flow is tricky. (why set up full, then select short?) Original code is written decades ago. There is no way for me to see how wxpython used to behave. I only can imagine that this code is so written to avoid some error. One point I can say is that this code used to work a while ago.

thank you very much.

class preW(wx.Dialog):
def init(self, …):
.
(prepare many sizers and contents.
checkbox for selection of full and short versions and short version is selected)
.
longVersionSetup()
.
sizer_1.Fit(self)
self.Layout()
self.SetSizer(parentSizer)
self.Layout()
self.watchCheckBox(none) (to select short version)
.

     .

def longVersionSetup(self):
     (prepare a big window dialog content)

def shortVersionSetup(self):
     (prepare a small window dialog content)

def watchCheckBos(self, event):
     (take care of checkbox, select short or long version)

Can you post the entire code somewhere I can get at it? I don’t think I’ll be able to help too much without seeing all the details and being able to poke it in various appropriate places. – As you say, it’s big and complicated.

You’re probably using a horizontal alignment flag while adding a child to a horizontal box sizer. Such as:

sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(button, 0, wx.ALIGN_CENTER_HORIZONTAL)

Try removing wx.ALIGN_CENTER_HORIZONTAL flag in the lines above and it won’t give that error.

Thank you for your posts.

I would post entire code, if I was allowed to post a lot of 1000 (+/-) line *.py files.

To make my life complicated, the code behaves a little differently, since last system update. The size of window gets larger, but not enough so that some contents are still squashed.

Currently, I do not think, flags are related. I have not completely ruled out yet,

You could try putting the .py files in a .zip file and then upload the .zip file in a post using the Upload button in the post editor:

upload_button_2

The .zip file would then appear as a download link in the post.