Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7043443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:17:24+00:00 2026-05-28T02:17:24+00:00

I’m having two problems with my program. The code below generates two panels when

  • 0

I’m having two problems with my program. The code below generates two panels when it should generate 3. It generates panel1 and panel2 no problem but panel3 should be to the right of panel2 is no where to be seen. Panel1 and panel2 are split vertically I’m trying to do the same with panel2 and panel3

My second problem is how do I generate another panel below panel1 without disrupting the splitter between panel1 and panel2 and then create a splitter between panel1 and new created panel below it?

import wx


class Panels(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        splitter = wx.SplitterWindow(self, -1)

        vbox1 = wx.BoxSizer(wx.VERTICAL)
        panel1 = wx.Panel(splitter, -1)
        panel12 = wx.Panel(panel1, -1, style=wx.BORDER_SUNKEN)
        st1 = wx.StaticText(panel12, -1, 'Panel 1', (5, 5))
        vbox1.Add(panel12, 1, wx.EXPAND)
        panel1.SetSizer(vbox1)

        vbox2 = wx.BoxSizer(wx.VERTICAL)
        panel2 = wx.Panel(splitter, -1)
        panel22 = wx.Panel(panel2, -1, style=wx.BORDER_RAISED)
        st2 = wx.StaticText(panel22, -1, 'Panel 2', (5, 5))
        vbox2.Add(panel22, 1, wx.EXPAND)
        panel2.SetSizer(vbox2)

        vbox3 = wx.BoxSizer(wx.VERTICAL)
        panel3 = wx.Panel(splitter, -1)
        panel32 = wx.Panel(panel3, -1, style=wx.BORDER_RAISED)
        st3 = wx.StaticText(panel32, -1, 'Panel 3', (5, 5))
        vbox3.Add(panel32, 1, wx.EXPAND)
        panel3.SetSizer(vbox3)

        hbox.Add(splitter, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        self.SetSizer(hbox)
        self.CreateStatusBar()
        splitter.SplitVertically(panel1, panel3)
        splitter.SplitVertically(panel2, panel3)
        self.Centre()
        self.Show(True)


    def ExitApp(self, event):
        self.Close()


app = wx.App()
Panels(None, -1, 'Panels')
app.MainLoop()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:17:25+00:00Added an answer on May 28, 2026 at 2:17 am

    You have a couple options. You could nest your SplitterWindows, which is kind of confusing, but effective. Or you could use the MultiSplitterWindow widget.

    For the first one, I’d do something like this:

    1. Create a main splitter and a sub-splitter
    2. In the sub-splitter, but the first two panels
    3. Put the sub-splitter and the 3rd panel in the main splitter

    Or some variation thereof.

    EDIT: Here’s one example:

    import wx
    
    ########################################################################
    class RandomPanel(wx.Panel):
        """"""
    
        #----------------------------------------------------------------------
        def __init__(self, parent, color):
            """Constructor"""
            wx.Panel.__init__(self, parent)
            self.SetBackgroundColour(color)
    
    
    
    ########################################################################
    class MainPanel(wx.Panel):
        """"""
    
        #----------------------------------------------------------------------
        def __init__(self, parent):
            """Constructor"""
            wx.Panel.__init__(self, parent)
    
            topSplitter = wx.SplitterWindow(self)
            hSplitter = wx.SplitterWindow(topSplitter)
    
            panelOne = RandomPanel(hSplitter, "blue")
            panelTwo = RandomPanel(hSplitter, "red")
            hSplitter.SplitVertically(panelOne, panelTwo)
            hSplitter.SetSashGravity(0.5)
    
            panelThree = RandomPanel(topSplitter, "green")
            topSplitter.SplitHorizontally(hSplitter, panelThree)
            topSplitter.SetSashGravity(0.5)
    
            sizer = wx.BoxSizer(wx.VERTICAL)
            sizer.Add(topSplitter, 1, wx.EXPAND)
            self.SetSizer(sizer)
    
    ########################################################################
    class MainFrame(wx.Frame):
        """"""
    
        #----------------------------------------------------------------------
        def __init__(self):
            """Constructor"""
            wx.Frame.__init__(self, None, title="Nested Splitters",
                              size=(800,600))
            panel = MainPanel(self)
            self.Show()
    
    #----------------------------------------------------------------------
    if __name__ == "__main__":
        app = wx.App(False)
        frame = MainFrame()
        app.MainLoop()
    

    See also might want to look at wx.SashLayoutWindow: http://www.wxpython.org/docs/api/wx.SashLayoutWindow-class.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I want to count how many characters a certain string has in PHP, but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.