473,756 Members | 3,499 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(w xFrame):
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(1 00,100))
self.bitmap02 = wxStaticBitmap( self, -1,
wxEmptyBitmap(1 00,100))
self.bitmap03 = wxStaticBitmap( self, -1,
wxEmptyBitmap(1 00,100))
self.bitmap04 = wxStaticBitmap( self, -1,
wxEmptyBitmap(1 00,100))

box = wxBoxSizer(wxHO RIZONTAL)

box.Add((10,10) )
box.Add(self.bi tmap01, 0, wxALIGN_CENTER)
box.Add((10,10) )
box.Add(self.bi tmap02, 0, wxALIGN_CENTER)
box.Add((10,10) )
box.Add(self.bi tmap03, 0, wxALIGN_CENTER)
box.Add((10,10) )
box.Add(self.bi tmap04, 0, wxALIGN_CENTER)
box.Add((10,10) )

self.SetAutoLay out(True)
self.SetSizer(b ox)

class MySmallApp(wxAp p):
def OnInit(self):
frame = smallAppFrame(N one, -1, "MySmallApp ")
frame.Show(true )
self.SetTopWind ow(frame)
return true

app = MySmallApp(0)
app.MainLoop()

Oct 17 '05 #1
3 3496
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(w xFrame):
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(1 00,100))
self.bitmap02 = wxStaticBitmap( self, -1,
wxEmptyBitmap(1 00,100))
self.bitmap03 = wxStaticBitmap( self, -1,
wxEmptyBitmap(1 00,100))
self.bitmap04 = wxStaticBitmap( self, -1,
wxEmptyBitmap(1 00,100))

box = wxBoxSizer(wxHO RIZONTAL)

box.Add((10,10) )
box.Add(self.bi tmap01, 0, wxALIGN_CENTER)
box.Add((10,10) )
box.Add(self.bi tmap02, 0, wxALIGN_CENTER)
box.Add((10,10) )
box.Add(self.bi tmap03, 0, wxALIGN_CENTER)
box.Add((10,10) )
box.Add(self.bi tmap04, 0, wxALIGN_CENTER)
box.Add((10,10) )

self.SetAutoLay out(True)
self.SetSizer(b ox)

class MySmallApp(wxAp p):
def OnInit(self):
frame = smallAppFrame(N one, -1, "MySmallApp ")
frame.Show(true )
self.SetTopWind ow(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************ *********@g14g2 000cwa.googlegr oups.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(w xFrame):
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(1 00,100))
self.bitmap02 = wxStaticBitmap( self, -1,
wxEmptyBitmap(1 00,100))
self.bitmap03 = wxStaticBitmap( self, -1,
wxEmptyBitmap(1 00,100))
self.bitmap04 = wxStaticBitmap( self, -1,
wxEmptyBitmap(1 00,100))

box = wxBoxSizer(wxHO RIZONTAL)

box.Add((10,10) )
box.Add(self.bi tmap01, 0, wxALIGN_CENTER)
box.Add((10,10) )
box.Add(self.bi tmap02, 0, wxALIGN_CENTER)
box.Add((10,10) )
box.Add(self.bi tmap03, 0, wxALIGN_CENTER)
box.Add((10,10) )
box.Add(self.bi tmap04, 0, wxALIGN_CENTER)
box.Add((10,10) )

self.SetAutoLay out(True)
self.SetSizer(b ox)

class MySmallApp(wxAp p):
def OnInit(self):
frame = smallAppFrame(N one, -1, "MySmallApp ")
frame.Show(true )
self.SetTopWind ow(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(wxVE RTICAL).
The top subwindow would contain what you've done now, and the bottom one
would have the rest of your stuff.
_______________ _______________ _______________ _______________ ____________
TonyN.:' *firstname*nlsn ews@georgea*las tname*.com
' <http://www.georgeanels on.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
6607
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 sketch of what she wants me to develop. thanks for any suggestions. -- luc wastiaux - dustpuppy@airpost.net
3
2080
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 main window the listbox on the right side moves into the area of colored panel. This is a surprise to say the least. Has anyone of the GUI specialists an idea how to fix this? Kay PS. I tried this on WinXP only.
2
3136
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 get all kinds of screen artifacts and weirdness. My general goal is: list item with a few areas for text, every other item shaded a light color for readability, font color changes with selection. The listbox is populated with custom structurs...
1
1908
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 |wx.NO_FULL_REPAINT_ON_RESIZE) # build top area topSizer = self.buildTopPanel() # build input area inputSizer = self.buildInputPanel()
1
4347
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 I click the menu "Draw" --"New Drawing". The image with wx.BufferedDC/wx.BufferedPaintDC can move around on the frame. But If I uncomment those three commented lines in "class TestFrame" to add a new page (from wx.Notebook) with a tag and modify...
1
2214
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
1755
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 (wx.lib.buttonpanel), then below this I want to have I splitter window, more or less like the file explorer in Windows. This is (some of) my code:
3
2314
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 text control. I've tried adding a new panel object with the stuff i want to the sizer i'm using for my listbox (which is a panel which can contain other panels)... and then run update() and refresh() on everything... But it doesn't work.. i see a...
7
3182
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 my panel. Finally I am trying to use the drawImage method to draw the Image object to the panel. However I keep getting a nullpointerexception when I run the program. I think it has something to do with the drawImage statement I use but I don't...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9273
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10032
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9711
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7244
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5141
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
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 we have to send another system

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.