simple notebook with resize event

I have simple notebook example which is working fine but when I add the
self.Bind(wx.EVT_SIZE, self.onResize) Its does show notebook when launch.
any idea.
        
import wx

class PageOne(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        t = wx.StaticText(self, -1, "This is a PageOne object", (20,20))

class PageTwo(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        t = wx.StaticText(self, -1, "This is a PageTwo object", (40,40))

class PageThree(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        t = wx.StaticText(self, -1, "This is a PageThree object", (60,60))

class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, title="Simple Notebook Example")

        # Here we create a panel and a notebook on the panel
        p = wx.Panel(self)
        nb = wx.Notebook(p)

        # create the page windows as children of the notebook
        page1 = PageOne(nb)
        page2 = PageTwo(nb)
        page3 = PageThree(nb)

        # add the pages to the notebook with the label to show on the tab
        nb.AddPage(page1, "Page 1")
        nb.AddPage(page2, "Page 2")
        nb.AddPage(page3, "Page 3")

        # finally, put the notebook in a sizer for the panel to manage
        # the layout
        sizer = wx.BoxSizer()
        sizer.Add(nb, 1, wx.EXPAND)
        p.SetSizer(sizer)
        self.Bind(wx.EVT_SIZE, self.onResize)
        
    def onResize(self,event):
        print self.GetSize()

if __name__ == "__main__":
    app = wx.App()
    MainFrame().Show()
    app.MainLoop()

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/simple-notebook-with-resize-event-tp5723113.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Hi,

···

On 11/27/2014 0:01, linuxNewBee wrote:

I have simple notebook example which is working fine but when I add the
self.Bind(wx.EVT_SIZE, self.onResize) Its does show notebook when launch.
any idea.

I think you mean the notebook does NOT show.:slight_smile:

You are overriding the default sizing event handling, so if you want the default handling to also happen then you need to add "event.Skip()" to your onResize event handler.

http://wxpython.org/Phoenix/docs/html/Event.html?highlight=skip#Event.Skip

Werner

Thanks Werner,

···

On Thu, Nov 27, 2014 at 3:03 AM, Werner wernerfbd@gmx.ch wrote:

I have simple notebook example which is working fine but when I add the

self.Bind(wx.EVT_SIZE, self.onResize) Its does show notebook when launch.

any idea.
Hi,

On 11/27/2014 0:01, linuxNewBee wrote:

I think you mean the notebook does NOT show.:slight_smile:

You are overriding the default sizing event handling, so if you want the default handling to also happen then you need to add “event.Skip()” to your onResize event handler.

http://wxpython.org/Phoenix/docs/html/Event.html?highlight=skip#Event.Skip

Werner

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 wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Thanks and Regards
Hemadri Saxena
9086087510