473,503 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you draw this layout with wxpython?

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
3 3482
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6598
by: luc wastiaux | last post by:
Hello, my boss is looking for a tool that would enable her to draw web interfaces easily, like visio does for other types of diagrams. What she wants this for is , I assume, to give me an exact...
3
2062
by: Kay Schluehr | last post by:
Probably some of you know the amazing demo application for wxPython. When you open the Listbook demo in the Core Windows/Contols folder, replace there wx.LB_DEFAULT by wx.LB_RIGHT and resize the...
2
3109
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
1
1887
by: py | last post by:
I have the following code: class MainFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, wx.ID_ANY, title, style=wx.DEFAULT_FRAME_STYLE...
1
4310
by: zxo102 | last post by:
Hi everyone, I have tried two days to figure out how to draw the image in wx.BufferedDC on the page created by AddPage of wx.Notebook but still got no clue. The attached example works fine. If...
1
2202
by: nelson - | last post by:
Hi all, i'm developing an application that uses Floatcanvas to diplay a cartesian plane. how can i embed it into a "complex" layout? I have this controls MENUS TOOLBAR NOTEBOOK
2
1744
by: BjornB | last post by:
Hi! I'm totally new to Python and I'm jus nw trying to create my first application with wxPython, exciting! However, I have a problem: I'm creating a Frame with a menu and buttonpanel...
3
2290
by: Soren | last post by:
Hi, Id like to make my own special listbox.. I want to able (at the push of a button) to add another item to my special listbox... each item is a panel with a label, some buttons and maybe a...
7
3169
by: HxRLxY | last post by:
I am trying to write a simple program which will allow users to view pictures. I am loading an image as an icon, then assigning that ImageIcon to an Image object. Then i get the graphics context of...
0
7261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7445
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.