Can't get grid back into sizer

Michael Barron wrote:

I have included a small example file that shows the problem I'm having. I have a grid with data and a button that 'refreshes' the grid to show the new data. I can't seem to get the grid back into the sizer with the 20p border like it originally has.

Thanks for any help.

     def pushButton(self, event):
  self.vitalsgrid.Destroy()
  newvitalsgrid = myGrid(self, -1, 3, self.colLabels, self.newvitals)
  self.vitalsbox.Insert(0, newvitalsgrid, 1, wx.EXPAND|wx.ALL, 20)
         self.vitalsgrid = newvitalsgrid
         self.Layout()

BTW, you'll probably be better off to just update the data in the grid rather than destroying it and creating a new one.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks for the help; works now. The resize trick is interesting. Hopefully I remember it next time this happens.

Regarding updating the data- is that via .ClearGrid() and then .SetCellValue() again for each cell? I’m a little wary of making up my own table so using CreateGrid() seemed best for me (beginner).

Mike

···

On Wed, Feb 20, 2008 at 4:31 PM, Robin Dunn robin@alldunn.com wrote:

Michael Barron wrote:

I have included a small example file that shows the problem I’m having.

I have a grid with data and a button that ‘refreshes’ the grid to show

the new data. I can’t seem to get the grid back into the sizer with the

20p border like it originally has.

Thanks for any help.

def pushButton(self, event):

    self.vitalsgrid.Destroy()

    newvitalsgrid = myGrid(self, -1, 3, self.colLabels, self.newvitals)

    self.vitalsbox.Insert(0, newvitalsgrid, 1, wx.EXPAND|wx.ALL, 20)

     self.vitalsgrid = newvitalsgrid

     self.Layout()

BTW, you’ll probably be better off to just update the data in the grid

rather than destroying it and creating a new one.

Robin Dunn

Software Craftsman

http://wxPython.org Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org