FoldPanelBar on LabelBook

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FoldPanelBar on LabelBook

TSUBOTA Masami
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()

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: FoldPanelBar on LabelBook

Robin Dunn
TSUBOTA Masami wrote:
> 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?
>

I've tried to do something similar in the past and IIRC it was because
FPB makes some assumptions about what context it is used within and also
does not play well with sizers.  I had other options at the time and so
I didn't pursue a FPB-based solution.  Perhaps with the WIT you could
get enough insight about how it is working now to be able to implement
some fixes to allow it to work in the LabelBook or in other contexts.  I
expect that Andrea would be happy to review and apply them.
http://wiki.wxpython.org/Widget_Inspection_Tool

--
Robin Dunn
Software Craftsman
http://wxPython.org

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.