wx.lib.agw.labelbook and panel

Hi all,

Can a labelbook have a wx.Panel as its parent instead of wx.Frame?
I have tried but just the empty frame appears.This is how I did.

class MyFrame(wx.Frame):

** def init(self, parent):**

** wx.Frame.init(self, parent, -1, “LabelBook Demo”)**

** self.panel = wx.Panel(self,-1)**

** notebook = LB.LabelBook(self.panel, -1, agwStyle=LB.INB_FIT_LABELTEXT|LB.INB_LEFT|LB.INB_DRAW_SHADOW|LB.INB_GRADIENT_BACKGROUND)**

** pane1 = wx.Panel(notebook)**

** pane2 = wx.Panel(notebook)**

** notebook.AddPage(pane1, “Tab1”, 1, -1)**

** notebook.AddPage(pane2, “Tab2”, 0, -1**)

Hi,

Hi all,

Can a labelbook have a wx.Panel as its parent instead of wx.Frame?

It can indeed.

I have tried but just the empty frame appears.This is how I did.

class MyFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "LabelBook Demo")
self.panel = wx.Panel(self,-1)
notebook = LB.LabelBook(self.panel, -1,
agwStyle=LB.INB_FIT_LABELTEXT|LB.INB_LEFT|LB.INB_DRAW_SHADOW|LB.INB_GRADIENT_BACKGROUND)

    pane1 = wx\.Panel\(notebook\)
    pane2 = wx\.Panel\(notebook\)
    notebook\.AddPage\(pane1, "Tab1", 1, \-1\)
    notebook\.AddPage\(pane2, "Tab2", 0, \-1\)

You forgot the wx.Sizer part of your code :slight_smile:

Only your self.panel will expand to fill the wx.Frame area, all the
other widgets needs to be managed by a sizer to properly show up and
align and expand.

Try this:

class MyFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "LabelBook Demo")
        self.panel = wx.Panel(self,-1)
        notebook = LB.LabelBook(self.panel, -1,
agwStyle=LB.INB_FIT_LABELTEXT|LB.INB_LEFT|LB.INB_DRAW_SHADOW|LB.INB_GRADIENT_BACKGROUND)

        pane1 = wx.Panel(notebook)
        pane2 = wx.Panel(notebook)
        notebook.AddPage(pane1, "Tab1", 1, -1)
        notebook.AddPage(pane2, "Tab2", 0, -1)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(notebook, 1, wx.EXPAND)
        self.panel.SetSizer(sizer)
        sizer.Layout()

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 18 June 2012 19:45, Spondita wrote:

Thanks
Andrea…

···

On Tue, Jun 19, 2012 at 1:06 AM, Andrea Gavana andrea.gavana@gmail.com wrote:

Hi,

On 18 June 2012 19:45, Spondita wrote:

Hi all,

Can a labelbook have a wx.Panel as its parent instead of wx.Frame?

It can indeed.

I have tried but just the empty frame appears.This is how I did.

class MyFrame(wx.Frame):

def __init__(self, parent):
    wx.Frame.__init__(self, parent, -1, "LabelBook Demo")
    self.panel = wx.Panel(self,-1)
    notebook = LB.LabelBook(self.panel, -1,

agwStyle=LB.INB_FIT_LABELTEXT|LB.INB_LEFT|LB.INB_DRAW_SHADOW|LB.INB_GRADIENT_BACKGROUND)

    pane1 = wx.Panel(notebook)
    pane2 = wx.Panel(notebook)
    notebook.AddPage(pane1, "Tab1", 1, -1)
    notebook.AddPage(pane2, "Tab2", 0, -1)

You forgot the wx.Sizer part of your code :slight_smile:

Only your self.panel will expand to fill the wx.Frame area, all the

other widgets needs to be managed by a sizer to properly show up and

align and expand.

Try this:

class MyFrame(wx.Frame):

def __init__(self, parent):

    wx.Frame.__init__(self, parent, -1, "LabelBook Demo")

    self.panel = wx.Panel(self,-1)

    notebook = LB.LabelBook(self.panel, -1,

agwStyle=LB.INB_FIT_LABELTEXT|LB.INB_LEFT|LB.INB_DRAW_SHADOW|LB.INB_GRADIENT_BACKGROUND)

    pane1 = wx.Panel(notebook)

    pane2 = wx.Panel(notebook)

    notebook.AddPage(pane1, "Tab1", 1, -1)

    notebook.AddPage(pane2, "Tab2", 0, -1)

sizer = wx.BoxSizer(wx.VERTICAL)

    sizer.Add(notebook, 1, wx.EXPAND)

    self.panel.SetSizer(sizer)

    sizer.Layout()

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”

http://xoomer.alice.it/infinity77/

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en