2
我試着去創造這樣的:wxPython的:與wx.SashLayoutWindow多個面板
|---------------------------------------------|
| Panel 1a | Panel 2a | Panel 3 |
| | | |
| | | |
|-----------------------------------| |
| Panel 1b | Panel 2b | |
| | | |
|---------------------------------------------|
到目前爲止,我只能創建這樣的:
|---------------------------------------------|
| Panel 1a | Panel 2a | Panel 3 |
| | | |
| | | |
|---------------------------------------------|
我怎麼能分成兩半板1a和板2A ?用分離器?
我的代碼如下:
import wx
class TestSashWindow(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
winids = []
leftwin1 = wx.SashLayoutWindow(self, -1, wx.DefaultPosition, (200, 30), wx.NO_BORDER|wx.SW_3D)
leftwin1.SetDefaultSize((120, 1000))
leftwin1.SetOrientation(wx.LAYOUT_VERTICAL)
leftwin1.SetAlignment(wx.LAYOUT_RIGHT)
leftwin1.SetSashVisible(wx.SASH_LEFT, True)
self.leftWindow1 = leftwin1
winids.append(leftwin1.GetId())
self.remainingSpace = wx.Panel(self, -1, style=wx.SUNKEN_BORDER)
leftwin2 = wx.SashLayoutWindow(self, -1, wx.DefaultPosition, (200, 30), wx.NO_BORDER|wx.SW_3D)
leftwin2.SetDefaultSize((120, 1000))
leftwin2.SetOrientation(wx.LAYOUT_VERTICAL)
leftwin2.SetAlignment(wx.LAYOUT_LEFT)
leftwin2.SetSashVisible(wx.SASH_RIGHT, True)
self.leftWindow2 = leftwin2
winids.append(leftwin2.GetId())
self.remainingSpace = wx.Panel(self, -1, style=wx.SUNKEN_BORDER)
self.Bind(wx.EVT_SASH_DRAGGED_RANGE, self.OnSashDrag,id=min(winids), id2=max(winids))
self.Bind(wx.EVT_SIZE, self.OnSize)
slw = leftwin1
x = wx.Notebook(slw, -1)
for i in xrange(2):
x.AddPage(wx.Panel(x, -1), str(i))
class mainframe(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, size=(400,300), title="sash test")
self.a = TestSashWindow(self)
if __name__ == '__main__':
a = wx.App(0)
b = mainframe()
b.Show(1)
a.MainLoop()