Dear friends,
I have a panel with several grids and before creating and displaying the panel I have a dialog. The dialog contains four data. These data defines the size of the grids. If the first data is zero I hide the first grid and it works OK. If the second data is zero I hide the second grid and it works OK. When I try to have zero for the first and the second data I want to hide the first two grids. BUt then here the problem comes: the two grids are indeed hidden but the rest of the interface is displayed in a wrong way. I have tried to hide the sizer containing the two grids, I tried to use layout after but no matter what I try is not working properly.
I have attached all the files because it was difficult to reproduce the behaviour with something simpler.
First launch the application, then in the menu file then new. Then the dialog appears. IN the dialog if one uses zero for the first field and respectively for the second gets the behaviour described above. If both of them are zero then the rest of the interface displayed in a wrong way. At any time for the third and the fourth filed use a positive number.
PLease have a look at it and tell me what is wrong .
Thank you very much in advance,
With kind regards,
clone.zip (6.37 KB)
> No, I just ran it on linux, python 2.4 wx 2.8.3.0.
> Have you tried calling Layout() of the grid's parent object? Does it
repaint
> correctly when you resize the window?
<snip>
<snap>
Do you have other idea?
I didn't try the code, but a couple of suggestions:
1) Try to call Layout() on the main sizer as Christian suggested;
2) Use SendSizeEvent() on the main frame;
3) In case of failure of everything, try the desperate brute-force
attack (self is your frame):
size = self.GetSize()
self.SetSize((size.x+1, size.y+1))
self.SetSize(size)
If none of them works, I believe the code itself might have some problems...
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/
Hi Werner,
I just had a brief look at the output. Later on I will try to digest your changes. However I don;t want to change the size of the grids as it appears after you made the changes… Maybe it still a matter of the sizer placement.
Once I will digest your usggestions I will let you know.
Thank you any way,
···
On 3/26/07, Werner F. Bruhin < werner.bruhin@free.fr> wrote:
Hi Jupan,
Changes I made and some suggestions.
- Put all the controls from flexgridsizer2 - 7 into flexgridsizer 1.
- changed the Rows for flexgridsizer1 from 1 to 0 so rows are added to
it as needed
- changed the HGap from 400 to 5 - you might want to adjust this to
whatever you find nice
- changed the VGap from 0 to 5 - you might want to adjust this to
whatever you find nice
- you might also want to change the names of controls, e.g. self.button1
to self.okButton (just rename it in the Boa Inspector), as this will be
very difficult to maintain when your application gets bigger.
I am getting an encoding error on line 191 (and some others) of
MDIChildFlorin.py, which I tried to fix with
-
added a BOM, # -- coding: utf8 --#
-
forcing a setdefaultencoding(‘utf8’), in the application.py file
But I still get it, I am on Vista, Python 2.5 and wxPython 2.8.1.1
(ANSI), it is still trying to decode from latin-1, what does one need to
do to get this working?
I attached a zip with the changes.
Werner
jupan ghe wrote:
Dear friends,
I have a panel with several grids and before creating and displaying
the panel I have a dialog. The dialog contains four data. These data
defines the size of the grids. If the first data is zero I hide the
first grid and it works OK. If the second data is zero I hide the
second grid and it works OK. When I try to have zero for the first and
the second data I want to hide the first two grids. BUt then here the
problem comes: the two grids are indeed hidden but the rest of the
interface is displayed in a wrong way. I have tried to hide the sizer
containing the two grids, I tried to use layout after but no matter
what I try is not working properly.
I have attached all the files because it was difficult to reproduce
the behaviour with something simpler.
First launch the application, then in the menu file then new. Then the
dialog appears. IN the dialog if one uses zero for the first field and
respectively for the second gets the behaviour described above. If
both of them are zero then the rest of the interface displayed in a
wrong way. At any time for the third and the fourth filed use a
positive number.
PLease have a look at it and tell me what is wrong .
Thank you very much in advance,
With kind regards,
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Hi Jupan,
jupan ghe wrote:
Hi Werner,
I had a look at your changes. I could see how you have placed all the items in one flexgridsizer. Moreover I tried to comment out the child.maximize command in your file. I have also rearrange a bit. Any way first time when the child window is painted looks OK, but as soon as a re size or maximize the window the grids are improperly displayed. If a double click however inside the grid on a cell they are being repainted in the proper way.
I have also tried to call the layout method, or the sensizeevent but still the best that I could get both with my original version or with your version where you place all the controls inside the flexgridsizer, is this: I can see the grids in the slots where they are supposed to be but the area of the grids does not overlap the area of the socket.
What about adding a size event to your mdichildframe:
self.Bind(wx.EVT_SIZE, self.OnMDIChildFrame1Size)
def OnMDIChildFrame1Size(self, event):
self.grid1.ForceRefresh()
self.grid2.ForceRefresh()
self.grid3.ForceRefresh()
self.grid4.ForceRefresh()
event.Skip()
And these two lines to the end of the method "def __init__(self, parent, data):"
self.scrolledWindow1.Layout()
self.Layout()
I would also make the grids wider as having to scroll horizontaly is not very nice, for this change this:
parent.AddSizer(self.flexGridSizer1, 0, border=10,
flag=wx.ALIGN_CENTER | wx.ALL)
to:
parent.AddSizer(self.flexGridSizer1, 0, border=10,
flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND)
Hope this helps
Werner
Hi Werner,
The idea with the extra event worked very nice. Thank you very much.
One other thing it just come to my mind. How could I resize automatically the size of the sokets for the grids depending on the number of rows given by the user through the dialog.
I assume it shoud be something with fit or fit inside some how.
Until the next problem…
Have a nice day and thank you once again,
···
On 3/27/07, Werner F. Bruhin werner.bruhin@free.fr wrote:
Hi Jupan,
jupan ghe wrote:
Hi Werner,
I had a look at your changes. I could see how you have placed all the
items in one flexgridsizer. Moreover I tried to comment out the
child.maximize
command in your file. I have also rearrange a bit. Any
way first time when the child window is painted looks OK, but as soon
as a re size or maximize the window the grids are improperly
displayed. If a double click however inside the grid on a cell they
are being repainted in the proper way.
I have also tried to call the layout method, or the sensizeevent but
still the best that I could get both with my original version or with
your version where you place all the controls inside the
flexgridsizer, is this: I can see the grids in the slots where they
are supposed to be but the area of the grids does not overlap the area
of the socket.
What about adding a size event to your mdichildframe:
self.Bind(wx.EVT_SIZE, self.OnMDIChildFrame1Size)
def OnMDIChildFrame1Size(self, event):
self.grid1.ForceRefresh()
self.grid2.ForceRefresh()
self.grid3.ForceRefresh
()
self.grid4.ForceRefresh()
event.Skip()
And these two lines to the end of the method “def init(self,
parent, data):”
self.scrolledWindow1.Layout()
self.Layout()
I would also make the grids wider as having to scroll horizontaly is not
very nice, for this change this:
parent.AddSizer(self.flexGridSizer1, 0, border=10,
flag=wx.ALIGN_CENTER
wx.ALL)
to:
parent.AddSizer(self.flexGridSizer1, 0, border=10,
flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND)
Hope this helps
Werner
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org