我正在使用wxPython 2.8,我試圖在wx.Frame的右側添加滾動條功能。這個「右邊」是一個大小,我試圖使用wx.ScrolledWindow,但它似乎只適用於wx.Frame。我必須在滾動條的客戶端上添加一個wx.Panel嗎?怎麼樣 ? 有沒有例子?向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 !
使用本發明的 「工具欄」 ISN」 t顯示,沒有出現。 使用下面的構造,創建滾動:
self.scroll = wx.ScrolledWindow(self, -1)
其中自我是wx.Panel。
感謝所有幫助