New wxpython controls not displaying until resize

Posted by acrosman on Stack Overflow See other posts from Stack Overflow or by acrosman
Published on 2010-06-10T02:20:24Z Indexed on 2010/06/10 2:22 UTC
Read the original article Hit count: 246

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about python

Related posts about gui