Need assistance with wxPython (newbie)
Question: I need to create what I _think_ should be a simple GUI. I have very little
experience with building GUI's. I'm a visual learner and 'wxPython In Action'
isn't helping me out. I don't learn well by books written by Ph.D.'s. I'm
using Python 2.6. Many of the examples on the Internet don't work in Python
2.6.

I need to create a GUI with 3 columns and some buttons on the bottom.

On the first pass, each of the columns will be just multi-line text input.
I've creating a GUI that did have 3 columns using 3 panels but I couldn't get
the multi-line text input to fill the entire panel. I tried with boxsizer and
flexgridsizer with one panel but again, I couldn't get the multi-line text
input to fill the entire column.

Somewhere, I saw an example of almost exactly what I was looking for but I
either didn't bookmark it or it was in an example and I forget where it is.
This example had 3 columns where each of the columns could be width adjusted
like in a spreadsheet.

I've been at this for quite a few days and I haven't made any progress. What
I'm looking for is something akin to a Sashwindow but with 3 columns.

I've tried multiple panels, boxsizers with flexgridsizers but no luck. I've
gone through all of the wxPython demos and nothing comes closs. Perhaps
because what I looking for is too simple and not worthy of a demo. Some of the
columns in the real program will use selectable lists and grids but first I
need to start with the simplistic possible case.

Can anyone provide a minimalistic program that shows 3 columns with multi-line
text input filling the entire column? I'll figure out how to add the buttons
on the bottom.

Thank you,


Answer: You should take a look at [wxGlade](http://wxglade.sourceforge.net/). It's a
handy little GUI builder you can use to create your UI. After that, you can
also look at the code it generates and go from there.

**Edit:** Okay, here goes:

In wxGlade, create a new frame. Add a horizontal sizer with three slots. Add a
TextCtrl to the first slot. On the Layout page for the text control, check
wxEXPAND and set Proportion to 1; on the Widget page, check wxTE_MULTILINE.
Copy the text control to the clipboard and paste into into the two remaining
slots.

Here's the code that wxGlade generates:

    
    
    #!/usr/bin/env python
    # -*- coding: iso-8859-15 -*-
    # generated by wxGlade 0.6.3 on Tue Jul 21 20:00:54 2009
    
    import wx
    
    # begin wxGlade: extracode
    # end wxGlade
    
    
    
    class MyFrame(wx.Frame):
        def __init__(self, *args, **kwds):
            # begin wxGlade: MyFrame.__init__
            kwds["style"] = wx.DEFAULT_FRAME_STYLE
            wx.Frame.__init__(self, *args, **kwds)
            self.text_ctrl_1 = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
            self.text_ctrl_1_copy = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
            self.text_ctrl_1_copy_1 = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
    
            self.__set_properties()
            self.__do_layout()
            # end wxGlade
    
        def __set_properties(self):
            # begin wxGlade: MyFrame.__set_properties
            self.SetTitle("frame_1")
            # end wxGlade
    
        def __do_layout(self):
            # begin wxGlade: MyFrame.__do_layout
            sizer_1 = wx.BoxSizer(wx.VERTICAL)
            sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
            sizer_2.Add(self.text_ctrl_1, 1, wx.EXPAND, 0)
            sizer_2.Add(self.text_ctrl_1_copy, 1, wx.EXPAND, 0)
            sizer_2.Add(self.text_ctrl_1_copy_1, 1, wx.EXPAND, 0)
            sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
            self.SetSizer(sizer_1)
            sizer_1.Fit(self)
            self.Layout()
            # end wxGlade
    
    # end of class MyFrame
    
    
    if __name__ == "__main__":
        app = wx.PySimpleApp(0)
        wx.InitAllImageHandlers()
        frame_1 = MyFrame(None, -1, "")
        app.SetTopWindow(frame_1)
        frame_1.Show()
        app.MainLoop()
    

Hope that helps :-)

