issues with wx.StaticBox

I am new to wx.Python and I am stack.
Is it possible to put wx.Check and other widgets like
wx.DatePickerCtrl into wx.StaticBox?? I have found some examples with
Radiobuttons inside wx.StaticBox.
In short script displays an wx.ListCtrl box on the left, and some
check boxes and wx.StaticText arranges into wx.StaticBox on the right.
But the problem is that wx.StaticText is displayed but wx.Check box`es
are not. wx.DatePickerCtrl is frozen and doesn`t respond. Question
Why?
Here is some code:

import wx
import weeks as units

class RezFrame(wx.Frame):
    def __init__(self,parent):
        wx.Frame.__init__(self,parent,-1,title="NEW REZERVATION",
                          size=(1000,600))
        self.SetBackgroundColour("WHITE")
        panel = wx.Panel(self,-1)

        self.CreateStatusBar()
        ### LAYOUT GRID
        grid = wx.FlexGridSizer(2,2,2,20) # rows, cols, vgap, hgap

        ### DISPLAY PANEL 1
        lc = wx.ListCtrl(self,-1,pos=(10,10),size=(500,600),
                                   style = wx.LC_REPORT|
wx.SUNKEN_BORDER)

        ### CONTROL UNITS
        vs = wx.BoxSizer( wx.VERTICAL )

        box1_title = wx.StaticBox( self, -1, "Group 1" )
        box1 = wx.StaticBoxSizer( box1_title, wx.VERTICAL )
        grid1 = wx.FlexGridSizer( 0, 2, 0, 0 )

        # 1st group of controls:
        self.group1_ctrls = []
        t = wx.StaticText(self,-1,"Date: ",style = wx.RB_GROUP )
        t2 = wx.StaticText(self,-1,"Number: ")
        t3 = wx.StaticText(self,-1,"Type: ")
        t4 = wx.StaticText(self,-1,"Choose: ")
        t5 = wx.StaticText(self,-1,"Status: ")

        dpc = wx.DatePickerCtrl(self, style = wx.DP_DROPDOWN
                                > wx.DP_SHOWCENTURY
                                > wx.DP_ALLOWNONE )

        myList = range(11001,12000); l = []
        for i in myList:
            l += [str(i)]
        ch = wx.Choice(self, -1,choices=l)

        typ = ['option 1', 'option 2', 'option 3','option 4']
        ch2 = wx.Choice(self, -1, choices = typ)

        y = units.Names
        ch3 = wx.Choice(self, -1,choices = y)

        s = ('offer', 'rezervation')
        ch4 = wx.Choice(self, -1, choices = s)

        self.group1_ctrls.append((t, dpc))
        self.group1_ctrls.append((t2, ch))
        self.group1_ctrls.append((t3, ch2))
        self.group1_ctrls.append((t4, ch3))
        self.group1_ctrls.append((t5, ch4))

        for t, ch in self.group1_ctrls:
            grid1.Add( t, 0, wx.LEFT | wx.TOP, 5 )
            grid1.Add( ch, 0,wx.RIGHT|wx.TOP, 5 )

        box1.Add( grid1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
        vs.Add( box1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )

        w3 = wx.StaticText(self,-1,"C")

        grid.Add(lc)
        grid.Add(vs)
        grid.Add((10,-1))
        grid.Add(w3)

        border = wx.BoxSizer()
        border.Add(grid,0,wx.ALL,10)
        panel.SetSizerAndFit(border)
        self.Fit()

        self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, dpc)

    def OnDateChanged(self,event):
        print dpc.GetValue()

app = wx.App(0)
RezFrame(None).Show()
app.MainLoop()

Hi,

I am new to wx.Python and I am stack.
Is it possible to put wx.Check and other widgets like
wx.DatePickerCtrl into wx.StaticBox?? I have found some examples with
Radiobuttons inside wx.StaticBox.
In short script displays an wx.ListCtrl box on the left, and some
check boxes and wx.StaticText arranges into wx.StaticBox on the right.
But the problem is that wx.StaticText is displayed but wx.Check box`es
are not. wx.DatePickerCtrl is frozen and doesn`t respond. Question
Why?

All of your controls should be children of the Panel and not the
Frame. You are creating them all as children of the Frame but putting
them in a sizer belonging to the Panel, if you correct this I think
most of your issues should go away.

Hierarchy:

TLW (aka frame)
- Frame's Sizer
   - Panel
     - Panel's Sizer
       - panels children (i.e a Button)
       - ...

Cody

···

On Tue, Dec 21, 2010 at 8:06 PM, Alex86 <alex.radevic@gmail.com> wrote: