473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

gridSizer inside a panel element

why when I try to insert gridSizer to a panel which already inside
another panel the gridSizer doesn't work?

this is the code:

panel3= wx.Panel(self, -1, (0, 60), size=(400, 240) ,
style=wx.SIMPLE_BORDER);
panel3.SetBackgroundColour('#dadadb')
panel = wx.Panel(panel3, wx.ID_ANY, style=wx.SIMPLE_BORDER,
size=(150, 60))
panel.SetBackgroundColour("#fffFFF")

bmp = wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (16,
16))
inputIco = wx.StaticBitmap(panel, wx.ID_ANY, bmp)

labelThree= wx.StaticText(panel, wx.ID_ANY, 'Hello')

label2=wx.StaticText(panel, wx.ID_ANY, 'Pease, Quite, Hello, Shalom')
topSizer = wx.BoxSizer(wx.VERTICAL)
gridSizer = wx.GridSizer(rows=2, cols=1, hgap=5, vgap=5)
input = wx.BoxSizer(wx.HORIZONTAL)
output = wx.BoxSizer(wx.HORIZONTAL)
input.Add((20,20), 1, wx.EXPAND) # this is a spacer
input.Add(inputIco, 0, wx.ALL, 5)
input.Add(labelThree, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

output.Add((20,20), 1, wx.EXPAND) # this is a spacer

output.Add(label2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

gridSizer.Add(input, 0, wx.ALIGN_LEFT)
gridSizer.Add(output, 0, wx.ALIGN_RIGHT)

topSizer.Add(gridSizer, 0, wx.ALL|wx.EXPAND, 5)
panel.SetSizer(topSizer)
Aug 22 '08 #1
3 1663
On Aug 22, 2:09 pm, Gandalf <goldn...@gmail.comwrote:
why when I try to insert gridSizer to a panel which already inside
another panel the gridSizer doesn't work?

this is the code:

panel3= wx.Panel(self, -1, (0, 60), size=(400, 240) ,
style=wx.SIMPLE_BORDER);
panel3.SetBackgroundColour('#dadadb')
panel = wx.Panel(panel3, wx.ID_ANY, style=wx.SIMPLE_BORDER,
size=(150, 60))
panel.SetBackgroundColour("#fffFFF")

bmp = wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (16,
16))
inputIco = wx.StaticBitmap(panel, wx.ID_ANY, bmp)

labelThree= wx.StaticText(panel, wx.ID_ANY, 'Hello')

label2=wx.StaticText(panel, wx.ID_ANY, 'Pease, Quite, Hello, Shalom')
topSizer = wx.BoxSizer(wx.VERTICAL)
gridSizer = wx.GridSizer(rows=2, cols=1, hgap=5, vgap=5)
input = wx.BoxSizer(wx.HORIZONTAL)
output = wx.BoxSizer(wx.HORIZONTAL)

input.Add((20,20), 1, wx.EXPAND) # this is a spacer
input.Add(inputIco, 0, wx.ALL, 5)
input.Add(labelThree, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

output.Add((20,20), 1, wx.EXPAND) # this is a spacer

output.Add(label2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

gridSizer.Add(input, 0, wx.ALIGN_LEFT)
gridSizer.Add(output, 0, wx.ALIGN_RIGHT)

topSizer.Add(gridSizer, 0, wx.ALL|wx.EXPAND, 5)
panel.SetSizer(topSizer)
I'm not sure you can just add sizers together like that. When I'm
doing this I'd make panels for each sub-sizer; so input and output
would be panels rather than the sizers themselves. For example
(untested):

grid = wx.Panel(panel, wx.ID_ANY)

input = wx.Panel(grid, wx.ID_ANY)
inputIco = wx.StaticBitmap(input, wx.ID_ANY, bmp)
labelThree= wx.StaticText(input, wx.ID_ANY, 'Hello')
sz = wx.BoxSizer(wx.HORIZONTAL)
sz.Add((20,20), 1, wx.EXPAND) # this is a spacer
sz.Add(inputIco, 0, wx.ALL, 5)
sz.Add(labelThree, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
input.SetSizer(sz)

output = = wx.Panel(grid, wx.ID_ANY)
label2=wx.StaticText(output, wx.ID_ANY, 'Pease, Quite, Hello, Shalom')
sz = wx.BoxSizer(wx.HORIZONTAL)
sz.Add((20,20), 1, wx.EXPAND) # this is a spacer
sz.Add(label2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
output.SetSizer(sz)

sz = wx.GridSizer(rows=2, cols=1, hgap=5, vgap=5)
sz.Add(input, 0, wx.ALIGN_LEFT)
sz.Add(output, 0, wx.ALIGN_RIGHT)
grid.SetSizer(sz)

sz = wx.BoxSizer(wx.VERTICAL)
sz.Add(grid, 0, wx.ALL|wx.EXPAND, 5)
panel.SetSizer(sz)

Iain
Aug 22 '08 #2
On Aug 22, 8:09*am, Gandalf <goldn...@gmail.comwrote:
why when I try to insert gridSizer to a panel which already inside
another panel the gridSizer doesn't work?

this is the code:

<snip>

I'm not sure how to do multiple panels like that. And I'm not really
sure what you're trying to achieve by doing that anyway. Regardless,
you should post these types of questions to the wxPython user's group
where they can tell you exactly what you need to know:

http://wxpython.org/maillist.php

Mike
Aug 22 '08 #3
On Aug 22, 8:51*am, Iain King <iaink...@gmail.comwrote:
On Aug 22, 2:09 pm, Gandalf <goldn...@gmail.comwrote:
why when I try to insert gridSizer to a panel which already inside
another panel the gridSizer doesn't work?
this is the code:
panel3= wx.Panel(self, -1, (0, 60), size=(400, 240) ,
style=wx.SIMPLE_BORDER);
* * * * panel3.SetBackgroundColour('#dadadb')
* * * * panel = wx.Panel(panel3, wx.ID_ANY, style=wx.SIMPLE_BORDER,
size=(150, 60))
* * * * panel.SetBackgroundColour("#fffFFF")
* * * * bmp = wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (16,
16))
* * * * inputIco = wx.StaticBitmap(panel, wx.ID_ANY, bmp)
* * * * labelThree= wx.StaticText(panel, wx.ID_ANY, 'Hello')
* * * * label2=wx.StaticText(panel, wx.ID_ANY, 'Pease, Quite,Hello, Shalom')
* * * * topSizer *= wx.BoxSizer(wx.VERTICAL)
* * * * gridSizer = wx.GridSizer(rows=2, cols=1, hgap=5, vgap=5)
* * * * input = wx.BoxSizer(wx.HORIZONTAL)
* * * * output = wx.BoxSizer(wx.HORIZONTAL)
* * * * input.Add((20,20), 1, wx.EXPAND) # this is a spacer
* * * * input.Add(inputIco, 0, wx.ALL, 5)
* * * * input.Add(labelThree, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
* * * * output.Add((20,20), 1, wx.EXPAND) # this is a spacer
* * * * output.Add(label2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
* * * * gridSizer.Add(input, 0, wx.ALIGN_LEFT)
* * * * gridSizer.Add(output, 0, wx.ALIGN_RIGHT)
* * * * topSizer.Add(gridSizer, 0, wx.ALL|wx.EXPAND, 5)
* * * * panel.SetSizer(topSizer)

I'm not sure you can just add sizers together like that. *When I'm
doing this I'd make panels for each sub-sizer; so input and output
would be panels rather than the sizers themselves.
<snip>
>
Iain
Nesting sizers is pretty common, at least it is over at the wxPython
user's group: http://wxpython.org/maillist.php

I do it all the time, myself.

Mike
Aug 22 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: James | last post by:
Hello group: I'm trying to hide a panel control in javascript when a print button is clicked. On my web form, I have a button that fires a javascript function called doPrint(). No matter how I...
3
by: Fre | last post by:
Hi, Someone who can give me a tip how i can use a panel inside a datagrid? Thx in advance! Frederik
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
4
by: =?Utf-8?B?Rmx5Z3V5?= | last post by:
How can I update the html inside of a panel? How can I make this code work <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
2
by: sean.gilbertson | last post by:
Hi everyone, I'm adding columns to a DataTable, so that I can set it as the DataSource for a DataGrid. How can I go about putting a DIV element inside one of the column headers? I'm fine with...
1
by: bcwhite | last post by:
Python v2.5 wxPython v2.8.3.0 I've got an app that has a wx.Panel managed by a FlexGridSizer. There are 5 columns and 6 rows, all with StaticText widgets and all of similar size. Everything...
6
by: jrrtolkienfan | last post by:
hello, I'm very new to javascript and seem to be taking a lot of time getting things to work :( I have to use YUI to build a page. Basically when the page loads, it has a list of elements from...
1
by: gsauns | last post by:
I have a DetailsView inside a ModalPopup (using the AJAX ModalPopupExtender). I would like the user to have the ability to change the DetailsView's mode within the ModalPopup. But whenever I...
1
by: semomaniz | last post by:
I have a panel set up in a webpage and inside that panel i have various labels and textboxes setup. I am trying to assign a value to the label when the page loads. panel is named cpanel and a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.