I find it difficult to understand how to make sizers in wxPython work the way I want them (aside: am I the only one who thinks that wxPython is poorly documented?). I have 4 buttons and textctrl that I want to configure like this:
============================================== |WINDOW TITLE _ [] X| |============================================| |Button1 | Button2 | Button3 | Button4| |--------------------------------------------| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxTextCtrlxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| ==============================================
Buttons should expand horizontally, but not vertically, and textctrl should expand both horizontally and vertically. I tried almost all the sizer listed in the wxPython demo program and none of them worked - several boxsizers, gridsizers + boxsizeres, a simple gridsizer, flexgridsizer and rowcolsizer, but none of them work, can someone help? For reference, here is the code that I have right now.
...snip... panel = wx.Panel(self, -1) select_file = wx.Button(panel, self.BUTTON_0, "Select File") button1 = wx.Button(panel, self.BUTTON_1, "250 Words") button2 = wx.Button(panel, self.BUTTON_2, "500 Words") button3 = wx.Button(panel, self.BUTTON_3, "750 Words") self.txt = wx.TextCtrl(panel, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY) # Now to re-do this with gridsizers instead. # 4 rows, 4 columns, 2 pixel gap horizontally and vertically. grid = rcs.RowColSizer() # These buttons need to expand to fill their space, and then # expand when the windows are resized. grid.Add( select_file, row=1, col=1 ) grid.Add( button1, row=1, col=2 ) grid.Add( button2, row=1, col=3 ) grid.Add( button3, row=1, col=4 ) grid.Add( self.txt, row=2, col=1 ) ...snip...