views:

21

answers:

1

I have created a custom control (based on a panel) in wxPython that provides a list of custom controls on panel within it. The user needs to be able to add rows at will and have those rows displayed. I'm having trouble getting the new controls to actually appear after they are added. I know they are present, because they appear after a resize of the frame, or if I add them before Show() is called on the frame. I've convinced myself it's something basic, but I can't find the mistake.

The add function looks like this:

def addRow(self, id, reference, page, title, note):

    newRow = NoteListRow(self.listPanel, id, reference, page, title, note)
    self.listSizer.Add(newRow, flag=wx.EXPAND | wx.LEFT)
    self.rows.append(newRow)

    if len(self.rows) == 1:
        self.highliteRow(newRow)

    self.Refresh()
    self.Update()

    return newRow

I assume I'm missing something about how refresh and update are supposed to behave, so even a good extended reference on those would likely be helpful.

+1  A: 

Try self.Layout()

Try self.GetParent().Layout()

Including a Refresh().

Update() shouldn't be necessary.

FogleBird
self.GetParent().Layout() did the trick. Thanks!
acrosman