""" Demonstration of the Pmw NoteBookS megawidget.
"""

# Import Pmw from the sibling directory.
import sys
sys.path[:0] = ['../../..']

import Tkinter
import Pmw

class Demo:
    def __init__(self, parent):

	# Create and pack the NoteBook
	nb = Pmw.NoteBookS(parent)
	nb.pack(pady=10, padx=10, fill='both', expand=1)
	nb.addPage('fruit')
	nb.addPage('veges')
	nb.addPage('candy')

	# Fill in some pages
	frame1 = nb.getPage('fruit')
	frame2 = nb.getPage('veges')
	frame3 = nb.getPage('candy')
	Tkinter.Label(frame1, text='Apple', bg='green').pack(side='top')
	Tkinter.Label(frame1, text='Orange', bg='orange').pack(side='right')
	Tkinter.Label(frame2, text='Carrot', bg='orange').pack(side='left')
	Tkinter.Label(frame2, text='Peas', bg='green').pack(side='bottom')
	Tkinter.Label(frame3, text='Chocolate', bg='brown').pack(padx=30, pady=40, anchor='c')
	
######################################################################

# Create demo in root window for testing.
if __name__ == '__main__':
    root = Tkinter.Tk()
    Pmw.initialise(root, fontScheme = 'pmw1')
    root.title('Pmw NoteBook demonstration') 

    widget = Demo(root)
    exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
    exitButton.pack()
    root.mainloop()


