GridBagSizer layout issue

I thought I had the hang of layout and sizers now, and I mostly have but this
issue I'm having is eluding me.. I'm trying to get the first gauge to expand
like the second one is doing, but with no luck. Any ideas?

class Task(wx.Panel):
  
  def __init__(self,*args):
    wx.Panel.__init__(self,*args)

    sizer= wx.BoxSizer(wx.VERTICAL)
    
    current_file_sizer= wx.BoxSizer(wx.VERTICAL)
    current_file_header= wx.StaticText(self,-1,"Task 1")
    current_file_sizer.Add(current_file_header,0,wx.EXPAND)
    
    current_action_sizer= wx.GridBagSizer(5,5)
    current_action_icon= wx.StaticBitmap(self, -1,
wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,size=(40,40)))
    current_action_sizer.Add(current_action_icon,(0,0),(2,1))
    current_action_gauge= wx.Gauge(self,-1,size=(-1,20))
    current_action_sizer.Add(current_action_gauge,(0,1),(1,3),flag=wx.EXPAND)
    current_action_label= wx.StaticText(self,-1,"Current task...")
    current_action_sizer.Add(current_action_label,(1,1),(1,3),flag=wx.EXPAND)
    current_action_sizer.AddGrowableCol(2)
    current_action_sizer.AddGrowableRow(2)
    current_file_sizer.Add(current_action_sizer,0)
    sizer.Add(current_file_sizer,0,wx.EXPAND)
    
    overall_progress_sizer= wx.BoxSizer(wx.VERTICAL)
    overall_progress_header= wx.StaticText(self,-1,"Task 2")
    overall_progress_sizer.Add(overall_progress_header,0,wx.EXPAND)
    overall_progress_gauge= wx.Gauge(self,-1,size=(-1,20))
    overall_progress_sizer.Add(overall_progress_gauge,0,wx.EXPAND)
    sizer.Add(overall_progress_sizer,0,wx.EXPAND)

    self.SetSizerAndFit(sizer)

if __name__ == "__main__":
  app = wx.App(False)
  f = wx.Frame(None,-1,"TempFrame")
  p= Task(f,-1)
  f.Center()
  f.Show()
  app.MainLoop()

To: wxpython-users@lists.wxwidgets.org
From: poalman@gmail.com
Subject: [wxPython-users] GridBagSizer layout issue
Date: Thu, 13 Oct 2011 20:30:02 +0000

I thought I had the hang of layout and sizers now, and I mostly have but this
issue I’m having is eluding me… I’m trying to get the first gauge to expand
like the second one is doing, but with no luck. Any ideas?

Replace “current_file_sizer.Add(current_action_sizer,0)” with “current_file_sizer.Add(current_action_sizer,0,wx.EXPAND)”, that worked for me.