473,651 Members | 3,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SetBackg roundColour('#d adadb')
panel = wx.Panel(panel3 , wx.ID_ANY, style=wx.SIMPLE _BORDER,
size=(150, 60))
panel.SetBackgr oundColour("#ff fFFF")

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

labelThree= wx.StaticText(p anel, wx.ID_ANY, 'Hello')

label2=wx.Stati cText(panel, wx.ID_ANY, 'Pease, Quite, Hello, Shalom')
topSizer = wx.BoxSizer(wx. VERTICAL)
gridSizer = wx.GridSizer(ro ws=2, cols=1, hgap=5, vgap=5)
input = wx.BoxSizer(wx. HORIZONTAL)
output = wx.BoxSizer(wx. HORIZONTAL)
input.Add((20,2 0), 1, wx.EXPAND) # this is a spacer
input.Add(input Ico, 0, wx.ALL, 5)
input.Add(label Three, 0, wx.ALL|wx.ALIGN _CENTER_VERTICA L, 5)

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

output.Add(labe l2, 0, wx.ALL|wx.ALIGN _CENTER_VERTICA L, 5)

gridSizer.Add(i nput, 0, wx.ALIGN_LEFT)
gridSizer.Add(o utput, 0, wx.ALIGN_RIGHT)

topSizer.Add(gr idSizer, 0, wx.ALL|wx.EXPAN D, 5)
panel.SetSizer( topSizer)
Aug 22 '08 #1
3 1680
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.SetBackg roundColour('#d adadb')
panel = wx.Panel(panel3 , wx.ID_ANY, style=wx.SIMPLE _BORDER,
size=(150, 60))
panel.SetBackgr oundColour("#ff fFFF")

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

labelThree= wx.StaticText(p anel, wx.ID_ANY, 'Hello')

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

input.Add((20,2 0), 1, wx.EXPAND) # this is a spacer
input.Add(input Ico, 0, wx.ALL, 5)
input.Add(label Three, 0, wx.ALL|wx.ALIGN _CENTER_VERTICA L, 5)

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

output.Add(labe l2, 0, wx.ALL|wx.ALIGN _CENTER_VERTICA L, 5)

gridSizer.Add(i nput, 0, wx.ALIGN_LEFT)
gridSizer.Add(o utput, 0, wx.ALIGN_RIGHT)

topSizer.Add(gr idSizer, 0, wx.ALL|wx.EXPAN D, 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(i nput, 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(labelThr ee, 0, wx.ALL|wx.ALIGN _CENTER_VERTICA L, 5)
input.SetSizer( sz)

output = = wx.Panel(grid, wx.ID_ANY)
label2=wx.Stati cText(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_VERTICA L, 5)
output.SetSizer (sz)

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

sz = wx.BoxSizer(wx. VERTICAL)
sz.Add(grid, 0, wx.ALL|wx.EXPAN D, 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.SetBackg roundColour('#d adadb')
* * * * panel = wx.Panel(panel3 , wx.ID_ANY, style=wx.SIMPLE _BORDER,
size=(150, 60))
* * * * panel.SetBackgr oundColour("#ff fFFF")
* * * * bmp = wx.ArtProvider. GetBitmap(wx.AR T_TIP, wx.ART_OTHER, (16,
16))
* * * * inputIco = wx.StaticBitmap (panel, wx.ID_ANY, bmp)
* * * * labelThree= wx.StaticText(p anel, wx.ID_ANY, 'Hello')
* * * * label2=wx.Stati cText(panel, wx.ID_ANY, 'Pease, Quite,Hello, Shalom')
* * * * topSizer *= wx.BoxSizer(wx. VERTICAL)
* * * * gridSizer = wx.GridSizer(ro ws=2, cols=1, hgap=5, vgap=5)
* * * * input = wx.BoxSizer(wx. HORIZONTAL)
* * * * output = wx.BoxSizer(wx. HORIZONTAL)
* * * * input.Add((20,2 0), 1, wx.EXPAND) # this is a spacer
* * * * input.Add(input Ico, 0, wx.ALL, 5)
* * * * input.Add(label Three, 0, wx.ALL|wx.ALIGN _CENTER_VERTICA L, 5)
* * * * output.Add((20, 20), 1, wx.EXPAND) # this is a spacer
* * * * output.Add(labe l2, 0, wx.ALL|wx.ALIGN _CENTER_VERTICA L, 5)
* * * * gridSizer.Add(i nput, 0, wx.ALIGN_LEFT)
* * * * gridSizer.Add(o utput, 0, wx.ALIGN_RIGHT)
* * * * topSizer.Add(gr idSizer, 0, wx.ALL|wx.EXPAN D, 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
17033
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 attempt to write the line to reference the panel control, I get a Null error or an Object does not exist error. I know this can be done in asp.net, but I need the event to fire at the client, otherwise the page will print before firing the...
3
1778
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
3019
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 way I'm going about doing this might be a little off. I'd appreciate some help. Below is the code I have thus far but I'm not sure how to reference the user control within the foreach loop. <asp:Panel ID="pnlRosterProfile" runat="Server" />
4
15530
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">
2
1704
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 taking another approach. Thanks :-) Sean
1
1957
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 works fine until I Clear and re-fill the sizer a few times, then it puts all of the text in the upper-left corner. I can clear/refill the grid to my hearts contents but it doesn't fix itself. However, if I resize the main window the next...
6
1342
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 the server. It then has to show each of these elements in a panel along with other attributes of the element. Each of these panels should have a button to allow the user to obtain more detailed info about the element. So when th euser clicks on...
1
7189
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 click the button to change the mode, the ModalPopup closes itself. The NEXT time I open the ModalPopup, the mode has been changed. So the mode is changing... my problem is that I need the ModalPopup to stay visible. Also, the DetailsView is inside...
1
1525
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 label is named lbltext. i am positive that we cannot directly have lbltext.text = "this is a simple test" on the page load event since the control is present inside a panel control. Please advice. Forgot to mention i am using C#.
0
8361
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
8278
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
8807
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
8701
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...
1
8466
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8584
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
6158
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
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1588
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.