views:

37

answers:

1

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(self.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)
+1  A: 

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.

Steven Sproat
Ohhh! Thanks many many thanks. I have leaved it because one of the many constructor overload is without proportion as second parameter.
pyCoder
(Sorry I cant't to vote you because I don't have 15 point of reputation :( )
pyCoder
No worries - glad to have helped.
Steven Sproat