代码之家  ›  专栏  ›  技术社区  ›  pyCoder

wx.Panel中控件的完全内部大小调整

  •  0
  • pyCoder  · 技术社区  · 14 年前

    朋友们好:) 使用我的代码,wx.Panel中的wx.GenericDirCtrl不适合面板中的所有方向(如果使用wx.BoxSizer,则只适合某个方向)。 我在wx框架中使用我的面板距离。 我怎么解决?谢谢

    代码是:

    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)
    

    我在wx.Framec中引用面板的代码是:

    # 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 回复  |  直到 14 年前
        1
  •  1
  •   Steven Sproat    14 年前

    您使用的Add方法错误。它的签名是

    Add(self, item, proportion=0, flag=0, border=0, userData=None)
    

    您已将“flag”参数作为比例参数传递。

    推荐文章