By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,995 Members | 1,217 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,995 IT Pros & Developers. It's quick & easy.

How do you draw this layout with wxpython?

P: n/a
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()

Oct 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Tim
Young H. Rhiu 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()

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

Oct 17 '05 #2

P: n/a
In article <11*********************@g14g2000cwa.googlegroups. com>,
"Young H. Rhiu" <YH*****@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@georgea*lastname*.com
' <http://www.georgeanelson.com/>
Oct 17 '05 #3

P: n/a
Ask this question on the very active wxPython-users mailing list
(http://lists.sourceforge.net/lists/l...xpython-users). For sure
someone will help you out. If you don't want to write the code
yourself, but use a visual gui designer I strongly recommend using
wxGlade (http://wxglade.sourceforge.net/), which is very simple and
neat. It uses sizers by default, which has the advantage that you're
dialog box will be rescalable.

Stani
--
SPE - Stani's Python Editor (ships btw with wxGlade)
http://pythonide.stani.be

Oct 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.