How do you draw this layout with wxpython?

Y

Young H. Rhiu

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()
 
T

Tim

Young said:
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()
Hi
Take a LONG look at Boa Constructor. Boa is young, imperfect, and a
little emotional at times.

BUT after spending a few hours with it - I think I could create your
screen layout in a matter of minutes.

Really is worth the steep learning curve and the frustration.
timb
 
T

Tony Nelson

"Young H. Rhiu said:
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@georgea*lastname*.com
' <http://www.georgeanelson.com/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,785
Messages
2,569,624
Members
45,318
Latest member
LuisWestma

Latest Threads

Top