How do you draw this layout with wxpython?

Tony Nelson *firstname*nlsnews at georgea*lastname*.com
Mon Oct 17 12:30:48 EDT 2005


In article <1129531620.723991.53140 at g14g2000cwa.googlegroups.com>,
 "Young H. Rhiu" <YH.Rhiu at gmail.com> wrote:

> See: http://hilug.org/img/app_layout.GIF
> 
> I'm implementing an album-like application with wxpython but I'm new to
> wxPython though I know how to program with python. The problem is that
> it's not easy for me to deal with drawing layout stuff with wxpython.
> What layout I'm thinking of looks like the gif image above.
> 
> The application is about saving some comments for each pictures on the
> filesystem. There are two windows. The above one is a window for
> loading some images and the below one is a TextCtrl for writing
> comments and if img1, for instance, is clicked, the first notebook(?)
> folder should be active.
> 
> Below is the program I tried but I don't know how to attach a notebook
> window under the image window.
> Any help is greatly appreciated.
> 
> Thanks in Advance, Rhiu
> 
> My Code:
> from wxPython.wx import *
> 
> class smallAppFrame(wxFrame):
>     def __init__(self, parent, id, title):
>         wxFrame.__init__(self, parent = None, id = -1,
>                          title = "MySmallApp", pos = wxPoint(200, 200),
>                          size = wxSize(460, 200), style =
> wxDEFAULT_FRAME_STYLE)
> 
>         self.bitmap01 = wxStaticBitmap(self, -1,
> wxEmptyBitmap(100,100))
>         self.bitmap02 = wxStaticBitmap(self, -1,
> wxEmptyBitmap(100,100))
>         self.bitmap03 = wxStaticBitmap(self, -1,
> wxEmptyBitmap(100,100))
>         self.bitmap04 = wxStaticBitmap(self, -1,
> wxEmptyBitmap(100,100))
> 
>         box = wxBoxSizer(wxHORIZONTAL)
> 
>         box.Add((10,10))
>         box.Add(self.bitmap01, 0, wxALIGN_CENTER)
>         box.Add((10,10))
>         box.Add(self.bitmap02, 0, wxALIGN_CENTER)
>         box.Add((10,10))
>         box.Add(self.bitmap03, 0, wxALIGN_CENTER)
>         box.Add((10,10))
>         box.Add(self.bitmap04, 0, wxALIGN_CENTER)
>         box.Add((10,10))
> 
>         self.SetAutoLayout(True)
>         self.SetSizer(box)
> 
> class MySmallApp(wxApp):
>     def OnInit(self):
>         frame = smallAppFrame(None, -1, "MySmallApp")
>         frame.Show(true)
>         self.SetTopWindow(frame)
>         return true
> 
> app = MySmallApp(0)
> app.MainLoop()

I've never used (or learned) wxWidgets, and I'm even new to GTK, but I 
think you just need a deeper structure.  SmallAppFrame() would contain 
two subwindows, probably using something like wxBoxSizer(wxVERTICAL).  
The top subwindow would contain what you've done now, and the bottom one 
would have the rest of your stuff.
________________________________________________________________________
TonyN.:'                        *firstname*nlsnews at georgea*lastname*.com
      '                                  <http://www.georgeanelson.com/>



More information about the Python-list mailing list