Python wx Notebook使标签非常小

时间:2014-06-05 18:59:29

标签: python wxwidgets

我已经制作了这样一个标签类:

class TabPanel(wx.Panel):

    GRID_AREA = {}
    SURROUND_AREA = {}
    TOP_AREA = {}
    BORDER_AREA = {}
    OUTPUT_AREA = {}

    def __init__(self, parent):
        wx.Panel.__init__(self, parent = parent, id = wx.ID_ANY)

    def Initialize(self, grid_area):
        page_background_color = wx.Colour(150, 150, 150)

        self.GRID_AREA = grid_area

        self.SURROUND_AREA = wx.BoxSizer(wx.VERTICAL)
        self.SURROUND_AREA.Add(self.GRID_AREA, 0, wx.ALL, 15)

        self.TOP_AREA = wx.BoxSizer(wx.HORIZONTAL)
        self.TOP_AREA.Add(self.SURROUND_AREA, 0, wx.ALL, 15)

        self.OUTPUT_AREA = wx.TextCtrl(self, -1, size = (3366, 1768), style = (wx.TE_AUTO_SCROLL | wx.TE_LINEWRAP | wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH2))
        self.OUTPUT_AREA.SetBackgroundColour(page_background_color)

        self.BORDER_AREA = wx.BoxSizer(wx.VERTICAL)
        self.BORDER_AREA.Add(self.TOP_AREA, 0, wx.ALL, 15)
        self.BORDER_AREA.Add(self.OUTPUT_AREA, 0, 1, wx.EXPAND)    

        self.SetSizer(self.BORDER_AREA)
        self.SetAutoLayout(True)    

从中我得到了一个类,如下:

class TabPanel_Profiles(TabPanel):

    GRID_AREA = {}
    SURROUND_AREA = {}
    TOP_AREA = {}
    BORDER_AREA = {}
    OUTPUT_AREA = {}

    def __init__(self, parent):
        TabPanel.__init__(self, parent = parent)

        PROFILES_GRID_TEMPLATE = wx.FlexGridSizer(cols = 6, hgap = 6, vgap = 36)

        page_color = wx.Colour(30, 30, 30)
        text_color = wx.Colour(160, 190, 255)
        button_text_color = wx.Colour(70, 20, 130)

        ######################MAKE SOME CONTROLS HERE
        PROFILES_GRID_TEMPLATE.AddMany([ #LIST CONTROLS HERE

            ])

        self.Initialize(PROFILES_GRID_TEMPLATE)   

然后在大师班我做:

class MASTER_CLASS(wx.Notebook): 
    PROFILES_TAB = {}

    def __init__(self, parent, ID, log):
        wx.Notebook.__init__(self, parent, id=wx.ID_ANY, style = wx.BK_DEFAULT)


        self.PROFILES_TAB = TabPanel_Profiles(self)
        self.AddPage(self.PROFILES_TAB, "Profiles")

        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging)

    def OnPageChanged(self, event):
        old = event.GetOldSelection()
        new = event.GetSelection()
        sel = self.GetSelection()
        print 'OnPageChanged,  old:%d, new:%d, sel:%d\n' % (old, new, sel)
        event.Skip()

    def OnPageChanging(self, event):
        old = event.GetOldSelection()
        new = event.GetSelection()
        sel = self.GetSelection()
        print 'OnPageChanging, old:%d, new:%d, sel:%d\n' % (old, new, sel)
        event.Skip()      

当我创建它时,一切都非常小,在一个小角落,如果我点击它的一些下拉菜单展开,但为什么会这样?

0 个答案:

没有答案