wx.SplitterWindow(self, id, pos, size, style)
S.N. |
引數和說明
|
---|---|
1 |
wxSP_3D
繪製3D效果邊框和窗扇(sash)
|
2 |
wxSP_THIN_SASH
繪製一個薄sash
|
3 |
wxSP_3DSASH
繪製3D效果sash (預設樣式的一部分)
|
4 |
wxSP_BORDER
繪製標準邊框
|
5 |
wxSP_NOBORDER
無邊框(預設)
|
6 |
wxSP_PERMIT_UNSPLIT
總是允許取消分割,即使採用最小的窗格大小不為零
|
S.N. |
事件和說明
|
---|---|
1 |
EVT_SPLITTER_SASH_POS_CHANGING()
sash 的位置在被改變的過程
|
2 |
EVT_SPLITTER_SASH_POS_CHANGED()
窗框位置被改變
|
3 |
EVT_SPLITTER_UNSPLIT()
分割器一直只是取消分割
|
4 |
EVT_SPLITTER_DCLICK()
窗框被雙點選。預設行為是在取消分割視窗出現這種情況時
|
splitter = wx.SplitterWindow(self, -1)
b = wx.BoxSizer(wx.HORIZONTAL) self.text = wx.TextCtrl(panel1,style = wx.TE_MULTILINE) b.Add(self.text, 1, wx.EXPAND) panel1.SetSizerAndFit(b)
panel2 = wx.Panel(splitter, -1) languages = ['C', 'C++', 'Java', 'Python', 'Perl', 'JavaScript', 'PHP', 'VB.NET', 'C#'] lst = wx.ListBox(panel2, size = (100,300), choices = languages, style = wx.LB_SINGLE) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox1.Add(lst,1) panel2.SetSizer(hbox1)
splitter.SplitVertically(panel2, panel1)
import wx class Mywin(wx.Frame): def __init__(self, parent, title): super(Mywin, self).__init__(parent, title = title,size = (350,300)) splitter = wx.SplitterWindow(self, -1) panel1 = wx.Panel(splitter, -1) b = wx.BoxSizer(wx.HORIZONTAL) self.text = wx.TextCtrl(panel1,style = wx.TE_MULTILINE) b.Add(self.text, 1, wx.EXPAND) panel1.SetSizerAndFit(b) panel2 = wx.Panel(splitter, -1) languages = ['C', 'C++', 'Java', 'Python', 'Perl', 'JavaScript', 'PHP' ,'VB.NET' ,'C#'] lst = wx.ListBox(panel2, size = (100,300), choices = languages, style = wx.LB_SINGLE) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox1.Add(lst,1) panel2.SetSizer(hbox1) splitter.SplitVertically(panel2, panel1) self.Centre() self.Bind(wx.EVT_LISTBOX, self.onListBox, lst) self.Show(True) def onListBox(self, event): self.text.AppendText( "Current selection: " + event.GetEventObject().GetStringSelection() +"\n") ex = wx.App() Mywin(None,'Splitter Demo - www.tw511.com') ex.MainLoop()