Linux vs Windows issue

I have a GridBagSizer (sizer) with w x h bottons (one each cell),
I would like to destroy all buttons to reload them (with different w & h):

for row in range(h):
    for c in range(w):
             item = sizer.FindItemAtPosition((row, c))
             if item:
                    obj = item.GetWindow()
                    sizer.Detach(obj)
                    obj.Destroy()
        self.SetSizerAndFit(sizer)

               for a in range(t):
    button[a] = BitmapButton(self, id=a, bitmap=backImage, size=(xIm, yIm))
    RegisterId(a)
    sizer.Add(button[a], ( a/w, (a-(a/w)*w) ))
    self.Bind(EVT_BUTTON, self.OnButtonClick1, button[a])
    sizer.Fit(self)

[complete code on http://sourceforge.net/projects/pmemory/]

A few positions (where I expect buttons) are left empty in Windows,
while the code works as expected in Linux.

rosros

···

--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
  Sponsor:
Scopri il Blog di Email.it: curiosità , tendenze, storie in diretta dal Web
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8135&d=31-7

I have a GridBagSizer (sizer) with w x h bottons (one each cell),
I would like to destroy all buttons to reload them (with different w & h):

for row in range(h):
   for c in range(w):
            item = sizer.FindItemAtPosition((row, c))
            if item:
                   obj = item.GetWindow()
                   sizer.Detach(obj)
                   obj.Destroy()
       self.SetSizerAndFit(sizer)

If this is shown with correct indentation then repeatedly setting the same sizer object inside this loop will likely cause problems.

              for a in range(t):
   button[a] = BitmapButton(self, id=a, bitmap=backImage, size=(xIm, yIm))
   RegisterId(a)
   sizer.Add(button[a], ( a/w, (a-(a/w)*w) ))
   self.Bind(EVT_BUTTON, self.OnButtonClick1, button[a])
   sizer.Fit(self)

[complete code on http://sourceforge.net/projects/pmemory/\]

A few positions (where I expect buttons) are left empty in Windows,
while the code works as expected in Linux.

I would try it something like this:

1. Call sizer.Clear(deleteWindows=True)
2. Create a new sizer
3. Add items to the new sizer
4. Call self.SetSizer(newsizer)
5. Call self.Layout()

···

rosros-3@email.it wrote:

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