Hi I am having a real problem with replacing windows inside GridSizers . I had sent in a question a few days back where I got aorund the problem by changing the object instead of swapping it out. Now however I want to swap out the object and am having some problems.
The Replace help test suggests that I can call call replace with olditem and newitem. The docs seem to imply that I can also call it on index instead of item as the first argument. So when I say
self.grid_sizer.Replace(index , newwindow)
Where newwindow is a wx.Window object ( in my case a wx.ComboBox). When I do this I get a "‘Sizer__ReplaceItem’, expected argument 3 of type “wxSizerItem '”
I get a TypeError saying it expected a Window or sizer for the first parameter. ( “TypeError: Expected Window, Sizer, or integer for first parameter”.)
I know I am doing something wrong but I dont know how to swap out a window .
Please can someone send me a link to a working method call .
Hi I am having a real problem with replacing windows inside GridSizers . I had sent in a question a few days back where I got aorund the problem by changing the object instead of swapping it out. Now however I want to swap out the object and am having some problems.
The Replace help test suggests that I can call call replace with olditem and newitem. The docs seem to imply that I can also call it on index instead of item as the first argument. So when I say
self.grid_sizer.Replace(index , newwindow)
Where newwindow is a wx.Window object ( in my case a wx.ComboBox). When I do this I get a "'Sizer__ReplaceItem', expected argument 3 of type "wxSizerItem '"
I get a TypeError saying it expected a Window or sizer for the first parameter. ( "TypeError: Expected Window, Sizer, or integer for first parameter".)
I know I am doing something wrong but I dont know how to swap out a window .
Please can someone send me a link to a working method call .
Not sure what's going on there, the 2nd one should have worked. Are you sure that you are getting a window for the expression in the first parameter?
Anyway, an easy way to do this that might make a bit more sense is to simply Destroy() the old widget and let it remove itself from the sizer. Then you can sizer.Insert the new widget into the position you want it to be.
Hi Robin
Thanks for your email
I stopped seeing the weird behavior with GridSizer.Replace() once I inserted dummy panels into all the empty places in my GridSizer
Perviously I was using
Instead of
GridSizer.Add((1,1,),1) to fill up empty cells I started using a panel to fill in empty space.
dummypanel = wx.Panel(self,-1,size=(140,-1))
For some reason the spacer objects were giving the funny behavior I observed with the replace method. Once I started inserting dummy panels into empty spaces . I got the behavior I desired
Thanks for your help
Hari
···
On Mon, Jul 27, 2009 at 4:19 PM, Robin Dunn robin@alldunn.com wrote:
hari jayaram wrote:
Hi I am having a real problem with replacing windows inside GridSizers .
I had sent in a question a few days back where I got aorund the problem
by changing the object instead of swapping it out. Now however I want to
swap out the object and am having some problems.
The Replace help test suggests that I can call call replace with olditem
and newitem. The docs seem to imply that I can also call it on index
instead of item as the first argument. So when I say
self.grid_sizer.Replace(index , newwindow)
Where newwindow is a wx.Window object ( in my case a wx.ComboBox). When
I do this I get a "‘Sizer__ReplaceItem’, expected argument 3 of type