title = 'Pmw.Group demonstration' # Import Pmw from this directory tree. import sys sys.path[:0] = ['../../..'] import Tkinter import Pmw # define constant to switch between working/non-working examples Yes = Tkinter.YES No = Tkinter.NO working_example = No class Demo: def __init__(self, parent): # Create and pack the Groups. if working_example: f0 = parent else: BodyFrame = Pmw.ScrolledFrame(parent, hscrollmode='dynamic', vscrollmode='dynamic', #usehullsize='yes', hull_width=600, hull_height=450) BodyFrame.pack(side='top', expand='yes', fill='both') f0 = BodyFrame.interior() w = Pmw.Group(f0, tag_pyclass = Tkinter.Button, tag_text='Show/Hide') w.configure(tag_command = w.toggle) w.pack(fill = 'both', expand = 1, padx = 6, pady = 6) cw = Tkinter.Label(w.interior(), background = 'aliceblue', text = 'Now you see me.\nNow you don\'t.' ) cw.grid(column=0, row=0, sticky='nsew') for i in range(3): for j in range(3): Tkinter.Entry(w.interior(), textvariable=Tkinter.StringVar() ).grid(column=j+1, row=i+1) #w.toggle() # ##################################################################### # Create demo in root window for testing. if __name__ == '__main__': root = Tkinter.Tk() Pmw.initialise(root) root.title(title) exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy) exitButton.pack(side = 'bottom') widget = Demo(root) root.mainloop()