1 title = 'Pmw.Group demonstration'
3 # Import Pmw from this directory tree.
5 sys.path[:0] = ['../../..']
11 def __init__(self, parent):
13 # Create and pack the Groups.
14 w = Pmw.Group(parent, tag_text='label')
15 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
16 cw = Tkinter.Label(w.interior(),
17 text = 'A group with the\ndefault Label tag')
18 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
20 w = Pmw.Group(parent, tag_pyclass = None)
21 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
22 cw = Tkinter.Label(w.interior(), text = 'A group\nwithout a tag')
23 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
26 self.var = Tkinter.IntVar()
28 radioframe = Tkinter.Frame(parent)
29 w = Pmw.Group(radioframe,
30 tag_pyclass = Tkinter.Radiobutton,
31 tag_text='radiobutton 1',
33 tag_variable = self.var)
34 w.pack(fill = 'both', expand = 1, side='left')
35 cw = Tkinter.Frame(w.interior(),width=200,height=20)
36 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
39 w = Pmw.Group(radioframe,
40 tag_pyclass = Tkinter.Radiobutton,
41 tag_text='radiobutton 2',
42 tag_font = Pmw.logicalfont('Helvetica', 4),
44 tag_variable = self.var)
45 w.pack(fill = 'both', expand = 1, side='left')
46 cw = Tkinter.Frame(w.interior(),width=200,height=20)
47 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
49 radioframe.pack(padx = 6, pady = 6, expand='yes', fill='both')
50 Pmw.aligngrouptags(radiogroups)
53 tag_pyclass = Tkinter.Checkbutton,
54 tag_text='checkbutton',
55 tag_foreground='blue')
56 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
57 cw = Tkinter.Frame(w.interior(),width=150,height=20)
58 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
61 tag_pyclass = Tkinter.Button,
62 tag_text='Tkinter.Button')
63 w.configure(tag_command = w.toggle)
64 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
65 cw = Tkinter.Label(w.interior(),
66 background = 'aliceblue',
67 text = 'A group with\na Button tag!?'
69 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
72 tag_pyclass = Tkinter.Button,
74 w.configure(tag_command = w.toggle)
75 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
76 cw = Tkinter.Label(w.interior(),
77 background = 'aliceblue',
78 text = 'Now you see me.\nNow you don\'t.'
80 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
82 ######################################################################
84 # Create demo in root window for testing.
85 if __name__ == '__main__':
90 exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
91 exitButton.pack(side = 'bottom')