On Wed, Apr 3, 2013 at 9:36 PM, Sarah Marques
<sarahbmarques@gmail.com>wrote:Well, I haven't specified the exact
design because this subject is not
so familiar to me, since I'm visually impaired. I asked you for help
because people tell me the design is messed up and I don't know what to
do, since I built all my windows based on examples I downloaded from
wxPython website. I supose this window I sent should have its combobox
labeled, and the two buttons bellow, side by side. I used the flexGrid
because docs explained that it would organize components like a grid and
it would expand and rearrange if needed, it is, if I add one more
component for example, right? The examples I got has something to do
with the book, so where can I find the examples you mentioned? Thank
you!
GridSizers are grids, just as their name suggests. They contain a
rectangular array of cells, some number of columns wide and some number of
rows high. You specify the number of rows and columns when you create the
sizer; as you add items to the grid, the cells are filled from top left to
bottom right.
In your case you've specified 4 rows but haven't specified columns, so
everything you add to the sizer is stacked vertically. The simplest thing
to do is to change
self.grid=wx.FlexGridSizer(rows=4, hgap=8, vgap=8)
to
self.grid=wx.FlexGridSizer(rows=2, cols=2, hgap=8, vgap=8)
This will get your first two items into the top row, and the two buttons
into the bottom row. However, it still isn't going to be pretty, because
the items in the various cells are different shapes.
wxPython's sizers are very powerful - you can achieve very precise,
beautiful designs. However, they are NOT simple, and they are NOT
forgiving - a very simple error can make your entire layout disappear into
a tiny dot in the top-left corner. Be aware! (Don't worry, though - as
soon as you find the error, everything comes back!)
I again definitely recommend the wxPython demo, which you can download from
the same page as wxPython itself:
http://wxpython.org/download.php#stable
Look for "wxPython Demo for Windows".
Boa sorte!