I want to use folded panel in wxPython, like one In explorer in Windows XP. I have tried to check through API and Demo but I cannot Get Idea. The Demo example is complicated
Anyone to get me up and running. I'm still googling, but your help is highly appreciated ;)

for quick demo, I have such a small quick code below, I want to put those three panels in side like the win XP's explorer, how do I do that?

I have attached the code and a photo

I Have made it. But I have problem in adding object of class myPanel to foldable panel. Is that possible in the first place?

import wx
import wx.lib.agw.foldpanelbar as fpb

class MyPanel(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        #Happy Widgetting!
        self.label = wx.StaticText(self, -1, "Testing Panel")
        self.slider1 = wx.Slider(self, -1)
        self.slider2 = wx.Slider(self, -1)
        self.slider3 = wx.Slider(self, -1)

        #Sizers are way to go!
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(self.label, 0, wx.EXPAND)
        vbox.Add(self.slider1, 0, wx.EXPAND)
        vbox.Add(self.slider2, 0, wx.EXPAND)
        vbox.Add(self.slider3, 0, wx.EXPAND)

        self.SetSizer(vbox)
        #self.Layout()


class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)
        self.mainpanel = wx.Panel(self, -1)
        #Happy widgetting!
        #self.panel1 = MyPanel(self.mainpanel) 
        #self.panel2 = MyPanel(self.mainpanel)
        #self.panel3 = MyPanel(self.mainpanel)
        
        images = wx.ImageList(16, 16)
        images.Add(wx.Bitmap("./icons/collapsed.png"))
        images.Add(wx.Bitmap("./icons/expanded.png"))
        
        
        self.foldablepanel = fpb.FoldPanelBar(self.mainpanel, -1, size = (100, 230))        
        fpanel = self.foldablepanel.AddFoldPanel("Volume", foldIcons = images)
        self.slider = wx.Slider(fpanel, -1)
        self.ok = wx.Button(fpanel, -1, "Ok")
        self.panel1 = MyPanel(fpanel)
        #Add them to the panel
        self.foldablepanel.AddFoldPanelWindow(fpanel, self.slider)
        self.foldablepanel.AddFoldPanelWindow(fpanel, self.ok)
        self.foldablepanel.AddFoldPanelWindow(fpanel, self.panel1, flags = fpb.FPB_COLLAPSE_TO_BOTTOM)
        
        self.foldablepanel.AddFoldPanelSeparator(fpanel)
        
        fpanel2 = self.foldablepanel.AddFoldPanel("Choices", foldIcons = images)
        self.choice1 = wx.CheckBox(fpanel2, -1, "Check this")
        self.choice2 = wx.CheckBox(fpanel2, -1, "Try this")
        self.ok2 = wx.Button(fpanel2, -1, "Ok")
        
        #Add them to the panel
        self.foldablepanel.AddFoldPanelWindow(fpanel2, self.choice1)
        self.foldablepanel.AddFoldPanelWindow(fpanel2, self.choice2)
        self.foldablepanel.AddFoldPanelWindow(fpanel2, self.ok2)
        

        """#Sizers are way to go!
        self.panel1 = MyPanel(self.mainpanel)
        self.panel2 = MyPanel(self.mainpanel)
        self.panel3 = MyPanel(self.mainpanel)
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(self.panel1, 0, wx.EXPAND)
        vbox.Add(self.panel2, 0, wx.EXPAND)
        vbox.Add(self.panel3, 0, wx.EXPAND)"""

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.foldablepanel, 0, wx.EXPAND)
        self.text = wx.TextCtrl(self.mainpanel, -1, style = wx.TE_MULTILINE)
        hbox.Add(self.text, 1, wx.EXPAND)
        
        #self.Show(True)
        

        self.mainpanel.SetSizer(hbox)
        self.Layout() 


app = wx.App(False)
f = MyFrame(None, -1, "Testing Folded Panel")
f.Show(True)
app.MainLoop()

Just ignore my commenting and triple quotes. It is just the way I play with codes when testing

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.