pythonwxpythonwxwidgetsboxsizer

StaticText items disappear in wx.StaticBox


I'm creating a staticbox and a staticboxsizer in a vertical sizer. Everything works fine for me, but not on the customer's environment.

Everything in the staticbox is displayed, but labels. snippet below shows how i construct the staticboxsizer.

    sbox2 = wx.StaticBox(self, wx.ID_ANY, 'CH1 Only')
    sboxsizer2 = wx.StaticBoxSizer(sbox2, wx.VERTICAL)

    gsizer9 = wx.GridBagSizer(1,1)
    gsizer9.Add(comp.MinMaxLabel_21, (1,0), (1,1), wx.ALL, 1)
    gsizer9.Add(comp.MinMax_21, (1,1), (1,1), wx.ALL, 1)

    gsizer9.Add(comp.MinMax_19, (2,1), (1,1), wx.ALL, 1)
    gsizer9.Add(comp.MinMaxLabel_19, (2,0), (1,1), wx.ALL, 1)

    gsizer9.Add(comp.VcOS_15, (3,1), (1,1), wx.ALL, 1)
    gsizer9.Add(comp.MinMaxLabel_22, (3,0), (1,1), wx.ALL, 1)


    gsizer9.Add(comp.MonLabel_18, (0,3), (1,1), wx.ALL, 1)
    gsizer9.Add(comp.MonLabel_21, (0,4), (1,1), wx.ALL, 1)
    gsizer9.Add(comp.MonLabel_17, (0,5), (1,1), wx.ALL, 1)
    comp.MonLabel_22.Wrap(40)
    gsizer9.Add(comp.MonLabel_22, (0,6), (1,1), wx.ALL, 1)
    comp.MonLabel_19.Wrap(40)
    gsizer9.Add(comp.MonLabel_19, (0,7), (1,1), wx.ALL, 1)

    gsizer9.Add(comp.VcOS_10, (1,3), (1,1), wx.ALL, 1)
    gsizer9.Add(comp.VcOS_11, (1,4), (1,1), wx.ALL, 1)
    gsizer9.Add(comp.VcOS_12, (1,5), (1,1), wx.ALL, 1)
    gsizer9.Add(comp.VcOS_13, (1,6), (1,1), wx.ALL, 1)
    gsizer9.Add(comp.VcOS_14, (1,7), (1,1), wx.ALL, 1)

    sboxsizer2.Add(gsizer9, 0,0,0)
    vsizer4.Add(sboxsizer2, 0,0,0)

comp.MinMaxLabel_* returns a wx.StaticText(label='blah'), nothing fancy, just a wrapper, which works fine for other ~400 items in other sizers. but in StaticBox or StaticBoxSizers, no StaticText displayed on customer's setup.

normally it is displayed as this in my setup: alt text http://img152.imageshack.us/img152/8758/normalnu9.jpg

this is what i get on customer's setup: alt text http://img258.imageshack.us/img258/2351/problematiczo2.jpg

both setups have the same wxpython versions, 2.8.9.1. but 2.8.* also displays on my environment. any suggestions?


Solution

  • The source code of wxStaticBox does different things in painting code, depending on whether XP themes are enabled. In the screen shot without themes everything looks OK, in the one with themes enabled the labels are missing. Could you try on your system with themes enabled, and see whether labels display OK? Or can your customer temporarily disable themes and check whether that fixes the problem?

    Also, what do you use as the parent for the labels - the frame / dialog or the static box? I can't see it from the posted code, but I would use the static box. Maybe this will make a difference too.