Full internal resize of control in wx.Panel
Hi at all friends :) I have a problem with a control inside a wx.Panel. With my code the wx.GenericDirCtrl inside a wx.Panel don't fit in all directions in the Panel (or fit only in a direction if I use wx.BoxSizer). I use an istance of MyPanel in a wx.Frame. How I can solve it? Thanks
The code is:
class MyPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, wx.ID_ANY)
resizeBox = wx.BoxSizer(wx.VERTICAL)
self.dir1 = wx.GenericDirCtrl(self, wx.ID_ANY)
resizeBox.Add(self.dir1, wx.EXPAND | wx.ALL)
self.SetSizerAndFit(resizeBox)
and the code where I instancing Panel in wx.Framec is:
# controls
self.splitterMain = wx.SplitterWindow(self, wx.ID_ANY) # create a vertical splitter
self.panel1 = MyPanel(s开发者_如何学Goelf.splitterMain)
self.panel1.SetBackgroundColour(wx.BLACK)
self.panel2 = wx.Panel(self.splitterMain, wx.ID_ANY)
self.panel2.SetBackgroundColour(wx.WHITE)
self.splitterMain.SplitVertically(self.panel1, self.panel2)
You're using the Add method wrong. Its signature is
Add(self, item, proportion=0, flag=0, border=0, userData=None)
You've passed the "flag" parameter as the proportion parameter.
精彩评论