wx.splitterwindow部件将应用程序的主区域划分为多个部分,用户可以使用鼠标指针来对这些部分进行缩放。
在邮件客户端(比如evolution)以及烧录软件(k3b)中均可见到,可以水平或垂直的划分一个区域。
专题教程:wxpython中文教程
例子:
#!/usr/bin/python
#coding=utf-8
#splitterwindow.py
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition,
wx.Size(350, 300))
splitter = wx.SplitterWindow(self, -1)
wx.StaticText(panel1, -1,
'''Whether you think that you can,
or that you can't, you are usually right.
nnn Henry Ford''',
(100, 100), style=wx.ALIGN_CENTER)
panel1.SetBackgroundColour(wx.LIGHT_GREY)
panel2 = wx.Panel(splitter, -1)
panel2.SetBackgroundColour(wx.WHITE)
splitter.SplitVertically(panel1, panel2)
self.Center()
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, 'splitterwindow.py')
frame.Show(True)
self.SetTopWindow(frame)
return True
app = MyApp(0)
app.MainLoop()