这段代码有什么问题?我正在尝试将笔记本放在由 boxsizer 控制的面板上。我是 wxpython 的新手,无法弄清楚我做错了什么。当我运行它时,它只会在角落里弄得一团糟:(
import wx
class TestNoteBook(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(600, 500))
panel = wx.Panel(self)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
leftpanel = wx.Panel(panel)
notebook = wx.Notebook(leftpanel)
posterpage = wx.Panel(notebook)
listpage = wx.Panel(notebook)
notebook.AddPage(posterpage, 'posters')
notebook.AddPage(listpage, 'list')
hsizer.Add(leftpanel, 1, wx.EXPAND)
rightpanel = wx.Panel(panel)
hsizer.Add(rightpanel, 1, wx.EXPAND)
panel.SetSizer(hsizer)
app = wx.App()
frame = TestNoteBook(None, -1, 'notebook')
frame.Show()
app.MainLoop()