gridSizer inside a panel element

Gandalf goldnery at gmail.com
Fri Aug 22 15:09:10 CEST 2008


why when I try to insert gridSizer to a panel which already inside
another panel the gridSizer doesn't work?

this is the code:

panel3= wx.Panel(self, -1, (0, 60), size=(400, 240) ,
style=wx.SIMPLE_BORDER);
        panel3.SetBackgroundColour('#dadadb')
	panel = wx.Panel(panel3, wx.ID_ANY, style=wx.SIMPLE_BORDER,
size=(150, 60))
        panel.SetBackgroundColour("#fffFFF")

        bmp = wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (16,
16))
        inputIco = wx.StaticBitmap(panel, wx.ID_ANY, bmp)

        labelThree= wx.StaticText(panel, wx.ID_ANY, 'Hello')

	label2=wx.StaticText(panel, wx.ID_ANY, 'Pease, Quite, Hello, Shalom')
	topSizer  = wx.BoxSizer(wx.VERTICAL)
        gridSizer = wx.GridSizer(rows=2, cols=1, hgap=5, vgap=5)
        input = wx.BoxSizer(wx.HORIZONTAL)
	output = wx.BoxSizer(wx.HORIZONTAL)


        input.Add((20,20), 1, wx.EXPAND) # this is a spacer
        input.Add(inputIco, 0, wx.ALL, 5)
        input.Add(labelThree, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

	output.Add((20,20), 1, wx.EXPAND) # this is a spacer

        output.Add(label2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

        gridSizer.Add(input, 0, wx.ALIGN_LEFT)
	gridSizer.Add(output, 0, wx.ALIGN_RIGHT)

        topSizer.Add(gridSizer, 0, wx.ALL|wx.EXPAND, 5)
        panel.SetSizer(topSizer)



More information about the Python-list mailing list