我正在使用wx
Python 2.8,我正在尝试在wx.Frame的右侧添加滚动条功能.这个“右侧”是一个sizer;我试图使用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 !
使用此示例,不显示“工具栏”,不显示任何内容.
使用以下构造函数创建滚动:
self.scroll = wx.ScrolledWindow(self, -1)
自我是一个wx.Panel.
谢谢你的帮助
最佳答案 尝试使用
ScrolledPanel,这是一个“更好”的ScrolledWindow.
(并确保将分级器分配给面板)