views:

96

answers:

2

Hi there, I'm using wxPython 2.8 and i'm trying to add scrollbar capabilities on the right side of a wx.Frame. This "right side" is a sizer; i have tried to use wx.ScrolledWindow but it seems to work only on wx.Frame. Do i have to add a wx.Panel on the client of the scrollbar ? How ? Is there an example ?

This is the piece of code in which i create the "right" sizer:

btnSizer = wx.GridSizer(6, num_art_per_riga)

for elemento in lista_elementi:
    self.button = MyButton(self.scroll, elemento.descrizionebreve, elemento.descrizione, is_articolo)

    self.button.Bind(wx.EVT_BUTTON , self.aggiungi_su_listbox)
    btnSizer.Add(self.button, proportion=0, flag=wx.ALIGN_LEFT|wx.EXPAND, border=0)
btnSizer.Layout()     

box = wx.StaticBox(self.scroll, -1, descrizione_box)
staticSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
staticSizer.Add(btnSizer)
self.toolbar.Add(staticSizer)      # this is the sizer at the right side

self.scroll.SetVirtualSize((600, 400)) #this is the scroll !

Using this example the "toolbar" isn't displayed, nothing appears. The scroll is created using the following constructor:

 self.scroll = wx.ScrolledWindow(self, -1)

where self is a wx.Panel.

Thanks for any help

A: 

To answer one of your questions, there are many examples. Download the wxPython Docs and Demos and you will have plenty of examples to follow.

Jeff
A: 

Try using a ScrolledPanel, it's a "better" ScrolledWindow.
(And make sure you assign the sizer to the panel)

Joril