[wxPython-users] Treebook

Andrea amarin at mr-service.it
Wed May 16 23:56:53 PDT 2007


On Wed, 2007-05-16 at 13:48 -0700, Robin Dunn wrote: 
> Also, wx.Treebook is not a top-level window so it can't be created 
> without a parent.  You need to make a wx.Frame to contain it.

I try to clean my code for make it more standard, now I don't receive
any error messages, but I cannot see nothing, the frame and treebook are
not create,

Can someone help me?
Thanks Andrea

My code:

-----------------------------------------------------------------------

import wx

colourList = [ 'Andrea', 'Martina', 'Zoe', 'Matly',]

class TestTreebook(wx.Frame):

    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Test Treebook')
        self.tb = wx.Treebook(self, parent, id, style = wx.BK_DEFAULT)

        for item in colourList:
            self.tb1 = self.AddPage(self.tb, item)
            print 'Add page'
            self.AddSubPage(self.tb1, item, 'Sub Page')
            print 'Add Sub Page'

class MyApp(wx.App):

    def Oninit(self):
        self.frame = TestTreebook(parent = None, id = -1)
        self.frame.Center()
        self.frame.SetTopWindow(self.frame)
        self.frame.Show()
        return True

if __name__ == '__main__':
    app = MyApp()
    app.MainLoop()





More information about the wxpython-users mailing list