Most buttons in a wxGridSizer not showing

Hi,

I'm fairly new to wxPython. Stumped here. I am trying to, when someone
clicks on a button on the main window, show a popup window with a grid of
other buttons, one for each letter.

What happens is that only the Z button appears in the upper left corner.
However, the grid is sized appropriately so that all of them SHOULD show ...
they just don't! What's up?

Here's what I have: (I've also tried a few other combinations of things)

class LastNamePopup(wxPopupWindow):
  def __init__(self,parent,style):
    wxPopupWindow.__init__(self,parent,style)
    self.b = wxGridSizer(cols=6)
    self.buttons = []
    for j in range(ord('A'), ord('Z')+1):
      self.buttons.append(wxButton(self,2000+j,chr(j),size=wxSize(30,30)))
      self.b.Add(self.buttons[j-ord('A')],0,wxEXPAND)
      EVT_BUTTON(self,2000+j,self.clicked)
    self.SetSizer(self.b)
    self.b.Fit(self)
    self.SetAutoLayout(1)
    self.Fit()
    self.Show(true)

  def clicked(self,evt):
    print evt.GetId()
    self.Destroy()
    pass

Thanks,
Micah

···

--
Like to travel? http://TravTalk.org
Micah Yoder Internet Development http://yoderdev.com

Micah Yoder wrote:

Hi,

I'm fairly new to wxPython. Stumped here. I am trying to, when someone clicks on a button on the main window, show a popup window with a grid of other buttons, one for each letter.

What happens is that only the Z button appears in the upper left corner. However, the grid is sized appropriately so that all of them SHOULD show ... they just don't! What's up?

I don't think that wxPopupWindow handles autolayout, so you'll need to do it yourself by adding a call to self.Layout(). Also the second Fit() is redundant.

···

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