Note that there are some explanatory texts on larger screens.

plurals
  1. POwxPython - picking the right sizer to use in an application
    primarykey
    data
    text
    <p>I'm having trouble figuring out how to get the sizers in wxPython to work the way I want them to (aside: am I the only one who thinks that wxPython is poorly documented?). I've got 4 buttons and a textctrl that I want arranged like so:</p> <pre><code>============================================== |WINDOW TITLE _ [] X| |============================================| |Button1 | Button2 | Button3 | Button4| |--------------------------------------------| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxTextCtrlxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| ============================================== </code></pre> <p>The buttons should expand horizontally, but not vertically, and the textctrl should expand both horizontally and vertically. I've tried pretty much every sizer listed in the wxPython demo program and none of them worked - multiple boxsizers, gridsizers + boxsizeres, plain gridsizer, flexgridsizer and rowcolsizer but none of it works, could someone help? For reference, here's the code that I've got right now.</p> <pre><code> ...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... </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload