I am new to wx.Python and I am stack.
Is it possible to put wx.Check into wx.StaticBox?? I have found some examples with Radiobuttons inside wx.StaticBox.
In short window 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 dissplyed but wx.Check box`es are not. 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",
        panel = wx.Panel(self,-1)

        ### 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")


        border = wx.BoxSizer()

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

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

app = wx.App(0)

This stripped down version appears to work for me, but it is rewritten because it was too difficult to tell the i, l, and 1's apart, let alone what the variables with nonsense names are supposed to contain.

import wx

class TestFrame( wx.Frame ):

   def __init__( self ):
      wx.Frame.__init__ ( self, None, -1, 'wxPython' )
      self.panel = wx.Panel ( self, -1 )

      choice_list = ['     '+str(num) for num in range(1001,1100)]
      self.ch = wx.Choice(self, -1, size=(100, 25), choices=choice_list)

app = wx.App()

Edited 5 Years Ago by woooee: n/a

Mine widget wx.DatePickerCtrl in wx.StaticBox is frozen. I click on it and it doesn`t show me calendar. wx.Check boxes are not displayed at all.

If you want CheckBox in staticbox Try this

import wx

class Frame(wx.Frame):
    def __init__(self,parent):
        wx.Frame.__init__(self,parent,size=(400,300),title="STATIC CHECK BOX ")
        wx.StaticBox(self.pan, -1, 'BOXES', (5, 5), size=(100, 250))
    def dat(self):
        for x in range(1,10):
            wx.CheckBox(self.pan,-1,"%s %d"%("BOX",x),(15,20*x))

Sorry, the power has been out for the last 2 days. Try something along these lines. I use vertical and horizontal boxes. There may be another way, but this is explicit and works for me. You should also place each horizontal+vertical box(es) in a separate function to make it easier to see what is going where.

import wx

class TestFrame ( wx.Frame ):

   def __init__ ( self ):

      wx.Frame.__init__ ( self, None, -1, 'wxPython' )

      self.panel = wx.Panel ( self, -1 )
      vbox = wx.BoxSizer(wx.VERTICAL)

      hbox1 = wx.BoxSizer(wx.HORIZONTAL)

      datepic = wx.DatePickerCtrl(self.panel, -1, size=(110, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY)

      choice_list = ['     '+str(num) for num in range(1001,1100)]
      print choice_list[0]
      self.ch = wx.Choice(self.panel, -1, size=(100, 25), choices=choice_list)

      hbox1.Add(datepic, 0, wx.ALL, 5)
      hbox1.Add(self.ch, 0, wx.ALL, 5)

      vbox.Add(hbox1, 0, wx.ALIGN_LEFT | wx.ALL, 5)

app = wx.App()

Edited 5 Years Ago by woooee: n/a

Thanks guys. I have found alternative for my interface layout just using BoxSizer`s and Static BoxSizer`s in frame. So i got rid out of panel. Actually I am new to wx.Python and I don`t understand primary aim of panels, why do we need them?

Panel helps event to have special precision and on window paltform, it give a diffenet frame colour.

This question has already been answered. Start a new discussion instead.