# experiments with wxNotebook # make sure you have wxPython installed # for instance install with wxPython2.5-win32-unicode-184.108.40.206-py24.exe # from http://prdownloads.sourceforge.net/wxpython/ # tested with Python24 vegaseat 18jul2005 import wx class Panel(wx.Panel): """ class Panel creates a panel with a multiline edit box on it, inherits wx.Panel """ def __init__(self, parent, id, txt, bgcolor): # create a panel wx.Panel.__init__(self, parent, id) self.SetBackgroundColour(bgcolor) self.edit1 = wx.TextCtrl(self, id, value=txt, pos=(10,10), size=(360,200), style=wx.TE_MULTILINE) self.edit1.SetBackgroundColour((240, 230, 220)) # modified wheat color self.edit1.SetFocus() # tell a story in three pages ... txt1 = """A priest was talking to a nun, and he saw that her belly was getting noticeably big, and he made a comment about it. She replied to him that it was just a little gas. """ txt2 = """A couple months later, he ran into her again. This time, her belly was really big. She just patted her belly and said, "Just a little gas." """ txt3 = """Two months went by, and he came across the nun again, and she was pushing a baby carriage. The priest bent down and looked into the carriage and said, "Cute little fart, isn't he?" """ app = wx.PySimpleApp() # create a window/frame, no parent, -1 is default ID frame = wx.Frame(None, -1, "Notebook Pages", size=(400,300)) nb = wx.Notebook(frame, -1) # create the content of each page panel1 = Panel(nb, -1, txt1, "yellow") panel2 = Panel(nb, -1, txt2, "green") panel3 = Panel(nb, -1, txt3, "red") # create the notebook pages, add content and title to each page nb.AddPage(panel1, "Page1") nb.AddPage(panel2, "Page2") nb.AddPage(panel3, "Page3") frame.Show(True) # start the event loop app.MainLoop()
Are you able to help answer this sponsored question?
Questions asked by members who have earned a lot of community kudos are featured in order to give back and encourage quality replies.