如何在wxpython中拆分笔记本?

时间:2013-09-13 23:40:37

标签: python split wxpython

我已将笔记本放在面板上,笔记本有4页。现在我想横向分割每个页面。顶部拆分将包含网格单元格,底部将包含图表。怎么做?

此致

1 个答案:

答案 0 :(得分:1)

import wx


class MainFrame(wx.Frame):

    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)
        panel = wx.Panel(self)
        notebook = wx.Notebook(panel)

        splitter_window = wx.SplitterWindow(notebook)
        notebook.AddPage(splitter_window, 'Splitter')
        panel1 = wx.Panel(splitter_window, style=wx.BORDER_THEME)
        wx.StaticText(panel1, label='Place Grid here')
        panel2 = wx.Panel(splitter_window, style=wx.BORDER_THEME)
        wx.StaticText(panel2, label='Place Chart here')
        splitter_window.SplitHorizontally(panel1, panel2, 50)

        p_sizer = wx.BoxSizer(wx.VERTICAL)
        p_sizer.Add(notebook, 1, wx.EXPAND | wx.ALL, 7)
        panel.SetSizer(p_sizer)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(panel, 1, wx.EXPAND)
        self.SetSizer(sizer)

if __name__ == "__main__":
    app = wx.App(False)
    frame = MainFrame(None)
    frame.Show()
    app.MainLoop()