wx.ScrolledWindow

Hi, I am creating a scrolled parent-panel with some static boxes inside:

                self.scroll = wx.ScrolledWindow(self.panel, -1,
size=(302,153), style=wx.VSCROLL)
    self.scroll.SetScrollbars(1, 79, 150, 153)
    self.panel2=wx.Panel(self.scroll,-1)
    sizer2=wx.BoxSizer(wx.VERTICAL)
    
                for doc in dic_sort(RerievalDic)[:4]:
      box=wx.StaticBox(self.panel2,-1,"Case History")
      sizer21=wx.StaticBoxSizer(box,orient=wx.VERTICAL)
      sttext2=wx.StaticText(self.panel2, -1, text, style=wx.ALIGN_CENTER)
      sizer21.Add(sttext2)
      self.buttonShow = wx.Button(self.panel2, -1, 'Show File', size=(90, 28))
      sizer21.Add(self.buttonShow,0, wx.ALIGN_CENTER)
      sizer2.Add(sizer21,1)
      self.panel2.SetSizer(sizer2)
      self.panel2.Fit()
      
    self.sizersearch.Add(self.scroll,0, wx.ALIGN_CENTER | wx.TOP, 5)

With this code every time I add boxes the wx.ScrolledWindow also grows. What
I want is to fix the size of the window so It is shown one box at the time
and when I scroll it the additional boxes can be seen. I don't know what's
wrong, I cant find the mistake, I would appreciate any help. Thanks.

Sofia

···

--
View this message in context: http://www.nabble.com/wx.ScrolledWindow-tp23841604p23841604.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Sofia PT wrote:

Hi, I am creating a scrolled parent-panel with some static boxes inside:

                self.scroll = wx.ScrolledWindow(self.panel, -1,
size=(302,153), style=wx.VSCROLL)
    self.scroll.SetScrollbars(1, 79, 150, 153)
    self.panel2=wx.Panel(self.scroll,-1)
    sizer2=wx.BoxSizer(wx.VERTICAL)
    
                for doc in dic_sort(RerievalDic)[:4]:
      box=wx.StaticBox(self.panel2,-1,"Case History")
      sizer21=wx.StaticBoxSizer(box,orient=wx.VERTICAL)
      sttext2=wx.StaticText(self.panel2, -1, text, style=wx.ALIGN_CENTER)
      sizer21.Add(sttext2)
      self.buttonShow = wx.Button(self.panel2, -1, 'Show File', size=(90, 28))
      sizer21.Add(self.buttonShow,0, wx.ALIGN_CENTER)
      sizer2.Add(sizer21,1)
      self.panel2.SetSizer(sizer2)
      self.panel2.Fit()
      
    self.sizersearch.Add(self.scroll,0, wx.ALIGN_CENTER | wx.TOP, 5)

With this code every time I add boxes the wx.ScrolledWindow also grows. What
I want is to fix the size of the window so It is shown one box at the time
and when I scroll it the additional boxes can be seen. I don't know what's
wrong, I cant find the mistake, I would appreciate any help. Thanks.

Try it without the panel, just make the other widgets be children of the scrolled window. Then try using FitInside instead of Fit.

···

--
Robin Dunn
Software Craftsman