I’ve added a few ListCtrl objects with no items added to them… so why aren’t they as thin as a single-line TextCtrl or something like that?
import wx
class panel1(wx.Panel):
def init(self, parent):
wx.Panel.init(self, parent)
row = wx.wx.StaticBoxSizer(wx.StaticBox(self,label=“wx.HORIZONTAL - proportion=1”),wx.HORIZONTAL)
row.Add(wx.StaticText(self,label=“proportion=0”,style=wx.BORDER_DOUBLE),0, wx.ALL,10)
row.Add(wx.StaticText(self,label=“proportion=1”,style=wx.BORDER_DOUBLE),1, wx.ALL,10)
row.Add(wx.ListCtrl(self,style=wx.LC_SMALL_ICON|wx.SUNKEN_BORDER),1,wx.EXPAND)
self.SetSizerAndFit(row)
class panel2(wx.Panel):
def init(self, parent):
wx.Panel.init(self, parent)
row = wx.StaticBoxSizer(wx.StaticBox(self,label=“wx.HORIZONTAL - proportion=1”),wx.HORIZONTAL)
row.Add(wx.StaticText(self,label=“proportion=1”,style=wx.BORDER_DOUBLE),1, wx.ALL,10)
row.Add(wx.StaticText(self,label=“proportion=2, wx.EXPAND”,style=wx.BORDER_DOUBLE),2, wx.EXPAND|wx.ALL,10)
list1 =wx.ListCtrl(self,style=wx.LC_SMALL_ICON|wx.SUNKEN_BORDER)
#list1.InsertColumn(0, ‘RMA’, width=-1)
row.Add(list1,1,wx.EXPAND)
self.SetSizerAndFit(row)
class Frame(wx.Frame):
def init(self):
wx.Frame.init(self, None, title=‘BoxSizer demo (resize the frame)’)
mainPanel = wx.Panel(self)
mainSizer = wx.BoxSizer(wx.VERTICAL)
mainPanel.SetBackgroundColour(wx.WHITE)
#layout = wx.StaticBoxSizer(wx.StaticBox(mainPanel,label=“wx.VERTICAL”),wx.VERTICAL)
row 1
row = panel1(mainPanel)
mainSizer.Add(row,1) # add row 1 without arguments
row 2
row = panel2(mainPanel)
mainSizer.Add(row,1) # add row 2 with proportion = 1
row 3
row = wx.StaticBoxSizer(wx.StaticBox(mainPanel,label=“wx.HORIZONTAL - proportion=1, wx.EXPAND”),wx.HORIZONTAL)
row.Add(wx.StaticText(mainPanel,label=“proportion=0”,style=wx.BORDER_DOUBLE),0, wx.ALL,10)
row.Add(wx.StaticText(mainPanel,label=“proportion=1”,style=wx.BORDER_DOUBLE),1, wx.ALL,10)
mainSizer.Add(row,1,wx.EXPAND) # add row 3 with proportion = 0 and wx.EXPAND
mainPanel.SetSizerAndFit(mainSizer)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.AddF(mainPanel, wx.SizerFlags(1).Expand())
self.SetSizerAndFit(sizer)
app = wx.App(False)
Frame().Show()
app.MainLoop()