Dear wxPythoners,
I'm wondering if it's possible to put FoldPanelBar(s) on a book such as
the LabelBook widget. I have no trouble just putting FPB on a main frame.
However, by combining FRB and LB, it doesn't work.
The following is my script. Would you please show me what's wrong?
Thanx in advance.
Best,
MT
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wx
import wx.lib.agw.labelbook as lb
import wx.lib.agw.foldpanelbar as fpb
class NotCollapsed(wx.Frame):
def __init__(self, parent, id=wx.ID_ANY, title='',
pos=wx.DefaultPosition, size=(400,300), style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.__init__(self, parent, id, title, pos, size, style)
nb = lb.LabelBook(self, -1,
agwStyle=lb.INB_FIT_LABELTEXT|lb.INB_LEFT|lb.INB_DRAW_SHADOW|lb.INB_SHOW_ONLY_TEXT)
panel_G = wx.Panel(nb)
panel_T = wx.Panel(nb)
layout_G = wx.BoxSizer(wx.VERTICAL)
pnl = fpb.FoldPanelBar(panel_G,wx.ID_ANY, wx.DefaultPosition,
wx.DefaultSize, fpb.FPB_VERTICAL)
# (1)
item = pnl.AddFoldPanel("(1) Sun", collapsed=False)
btnA = wx.Button(item, wx.ID_ANY, "Japan")
pnl.AddFoldPanelWindow(item, btnA, fpb.FPB_ALIGN_LEFT)
# (2)
item2 = pnl.AddFoldPanel("(2) Mon", collapsed=False)
btnB = wx.Button(item2, wx.ID_ANY, "Sakura")
pnl.AddFoldPanelWindow(item2, btnB, fpb.FPB_ALIGN_LEFT)
layout_G.Add(pnl, flag=wx.EXPAND | wx.ALL, border=10)
panel_G.SetSizer(layout_G)
nb.AddPage(panel_G, "General", 0, 0)
nb.AddPage(panel_T, "Test tab", 0, 0)
imagelist = wx.ImageList(1, 1)
nb.AssignImageList(imagelist)
class MyApp(wx.App):
def OnInit(self):
frame = NotCollapsed(None, title="Test")
frame.Show()
return True
app = MyApp()
app.MainLoop()