= How to create a splitter window (Phoenix) = '''Keywords :''' Splitter window. <<TableOfContents>> -------- = Introduction : = This widget enables to split the main area of an application into parts. The user can dynamically resize those parts with the mouse pointer. Such a solution can be seen in mail clients (evolution) or in burning software (k3b). You can split an area vertically or horizontally. (info by '''ZetCode / Jan Bodnar'''). -------- = Demonstrating : = __'''''Tested''' py3.x, wx4.x and Win10. ''__ Are you ready to use some samples ? ;) Test, modify, correct, complete, improve and share your discoveries ! (!) -------- == Sample one == {{attachment:img_sample_one.png}} {{{#!python # Sample_one.py """ Author : Jan Bodnar Website : zetcode.com """ import wx # class MyFrame # class MyApp #--------------------------------------------------------------------------- class MyFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, None, -1, title, size=(350, 300)) self.SetIcon(wx.Icon('./icons/wxwin.ico', wx.BITMAP_TYPE_ICO)) #------------ splitter = wx.SplitterWindow(self, -1) splitter.SetMinimumPaneSize(20) panel1 = wx.Panel(splitter, -1) panel1.SetBackgroundColour(wx.LIGHT_GREY) wx.StaticText(panel1, -1, "Whether you think that you can, or that you can't, you are usually right." "\n\n Henry Ford", (100,100), style=wx.ALIGN_CENTRE) panel2 = wx.Panel(splitter, -1) panel2.SetBackgroundColour(wx.YELLOW) splitter.SplitVertically(panel1, panel2) #------------ self.Centre() #--------------------------------------------------------------------------- class MyApp(wx.App): def OnInit(self): frame = MyFrame(None, -1, 'wx.SplitterWindow') frame.Show(True) self.SetTopWindow(frame) return True #--------------------------------------------------------------------------- app = MyApp(0) app.MainLoop() }}} -------- == Sample two == {{attachment:img_sample_two.png}} {{{#!python # sample_two.py """ https://maku77.github.io/python/wxpython/splitterwindow.html wx.SplitterWindow(Window parent, int id=-1, Point pos=DefaultPosition, Size size=DefaultSize, long style=SP_3D, String name=SplitterNameStr) -> SplitterWindow wx.SPLIT_VERTICAL wx.SPLIT_HORIZONTAL """ import wx # class MyFrame # class MyApp #--------------------------------------------------------------------------- class MyFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, None, -1, title, size=(300, 200)) self.SetIcon(wx.Icon('./icons/wxwin.ico', wx.BITMAP_TYPE_ICO)) #------------ self.InitializeComponents() #----------------------------------------------------------------------- def InitializeComponents(self): sp = wx.SplitterWindow(self) p1 = wx.Panel(sp, style=wx.SUNKEN_BORDER) p1.SetBackgroundColour('#fc751b') p2 = wx.Panel(sp, style=wx.SUNKEN_BORDER) p2.SetBackgroundColour('#1bb4fc') sp.SplitVertically(p1, p2, 100) # Split the window left and right. sp.SetMinimumPaneSize(1) # Minimum size of subwindow. #--------------------------------------------------------------------------- class MyApp(wx.App): def OnInit(self): frame = MyFrame(None, -1, 'wx.SplitterWindow') frame.Show(True) self.SetTopWindow(frame) return True #--------------------------------------------------------------------------- app = MyApp(0) app.MainLoop() }}} -------- = Download source = [[attachment:source.zip]] -------- = Additional Information = '''Link :''' - - - - - https://wiki.wxpython.org/TitleIndex https://docs.wxpython.org/ -------- = Thanks to = Jan Bodnar (sample_one.py coding), Maku77 (sample_two.py coding), the wxPython community... -------- = About this page = Date(d/m/y) Person (bot) Comments : 04/01/21 - Ecco (Created page for wxPython Phoenix). -------- = Comments = - blah, blah, blah....