sizers again

Try using a wxFlexGridSizer for the buttons.

buttonSizer = wxFlexGridSizer ( rows = 2,
                                          cols = 2,
                                          vgap = 5,
                                          hgap = 5 )

···

On Fri, 2004-02-27 at 12:20, Stanfield, Vicki {D167~Indianapolis} wrote:

I am trying to change the look of the gui that I have created. Right now
I have 4 buttons from top to bottom.

Something like this:
       _________
      [____1____]

        _________
      [____2____]

       _________
      [____3____]

        _________
      [____4____]

I want to have them paired by twos and from top to bottom.

More like this:
        _________ _________
      [____1____] [____2____]

        _________ _________
      [____3____] [____4____]

The code I am currently using is like this:

        self.button1 = wxButton(self, 32, label= "1",
                            style = wxBU_BOTTOM ,size=(150,20),
                            name = "button1")
        EVT_BUTTON(self, 32, self.button1job)

        self.button2 = wxButton(self, 33, label= "2",
                            style = wxBU_BOTTOM ,size=(150,20),
                            name = "button2")
        EVT_BUTTON(self, 33, self.button2job)

        self.button3 = wxButton(self, 34, label= "3",
                            style = wxBU_BOTTOM ,size=(150,20),
                            name = "button3")
        EVT_BUTTON(self, 34, self.button3job)

        self.button4 = wxButton(self, 35, label= "4",
                            style = wxBU_BOTTOM ,size=(150,20),
                            name = "button4")
        EVT_BUTTON(self, 35, self.button4job)

The sizer have set up right now contains other things too, so I assume
that I need to add a sizer within the box sizer below that will only
contain the buttons, but as yet, I have not gotten it to work right. Am
I even on the right track?

  box = wxBoxSizer(wxVERTICAL)
    box.Add(self.button1,0, wxALL|wxALIGN_CENTER, 10)
  box.Add(self.button2, 0, wxALL|wxALIGN_CENTER, 20)
  box.Add(self.button3, 0, wxALL|wxALIGN_CENTER, 20)
  box.Add(self.button4, 0, wxALL|wxALIGN_CENTER, 20)
        
TIA
--vicki

"A pessimist sees the difficulty in every opportunity; an optimist sees
the opportunity in every difficulty."
-- Winston Churchill

--
Jim West
CheckLogix -a Concord company
102 S. Tejon Ste 920, Colorado Springs, CO 80903
719.633.7005 x223 Fax: 719.633.7006 Cell: 719.660.5676

Try using a wxFlexGridSizer for the buttons.

buttonSizer = wxFlexGridSizer ( rows = 2,
                                          cols = 2,
                                          vgap = 5,
                                          hgap = 5 )

Bingo. Thanks.

"A pessimist sees the difficulty in every opportunity; an optimist sees
the opportunity in every difficulty."
  -- Winston Churchill