4 <meta name="description" content="Pmw - a toolkit for building high-level compound widgets in Python">
5 <meta name="content" content="python, megawidget, mega widget, compound widget, gui, tkinter">
6 <title>Pmw.Group reference manual</title>
9 <body bgcolor="#ffffff" text="#000000" link="#0000ee"
10 vlink="551a8b" alink="ff0000">
12 <h1 ALIGN="CENTER">Pmw.Group</h1>
14 <center><IMG SRC=Group.gif ALT="" WIDTH=428 HEIGHT=209></center>
16 <dt> <h3>Name</h3></dt><dd>
18 frame with ring border and tag
23 <dt> <h3>Inherits</h3></dt><dd>
24 <a href="MegaWidget.html">Pmw.MegaWidget</a><br>
26 <dt> <h3>Description</h3></dt><dd>
28 This megawidget consists of an interior frame with an exterior
29 ring border and an identifying tag displayed over the top edge of
30 the ring. The programmer can create other widgets within the
37 <dt> <h3>Options</h3></dt><dd>
38 Options for this megawidget and its base
39 classes are described below.<p></p>
40 <a name=option.collapsedsize></a>
41 <dl><dt> <strong>collapsedsize
43 Initialisation option. The distance from the bottom of the tag to the bottom of the ring
44 when the groupchildsite is collapsed. The default is <strong>6</strong>.</p>
48 <a name=option.tagindent></a>
49 <dl><dt> <strong>tagindent
51 Initialisation option. The distance from the left edge of the ring to the left side of
52 the tag component. The default is <strong>10</strong>.</p>
57 <dt> <h3>Components</h3></dt><dd>
58 Components created by this megawidget and its base
59 classes are described below.<p></p>
60 <a name=component.groupchildsite></a>
61 <dl><dt> <strong>groupchildsite
63 The frame which can contain other widgets to be grouped. By default, this component is a Tkinter.Frame.</p>
67 <a name=component.hull></a>
70 This acts as the body for the entire megawidget. Other components
71 are created as children of the hull to further specialise this
72 class. By default, this component is a Tkinter.Frame.</p>
76 <a name=component.ring></a>
79 This component acts as the enclosing ring around the
80 <strong>groupchildsite</strong>. The default <strong>borderwidth</strong> is <strong>2</strong> and the
81 default <strong>relief</strong> is <strong>'groove'</strong>. By default, this component is a Tkinter.Frame.</p>
85 <a name=component.tag></a>
88 The identifying tag displayed over the top edge of the enclosing
89 ring. If the pyclass for this component is <strong>None</strong>, (ie:
90 <code>tag_pyclass = None</code>, then no tag component is created. By default, this component is a Tkinter.Label.</p>
96 <dt> <h3>Methods</h3></dt><dd>
97 Only methods specific to this megawidget are described below.
98 For a description of its inherited methods, see the
99 manual for its base class
100 <strong><a href="MegaWidget.html#methods">Pmw.MegaWidget</a></strong>.
102 <a name=method.collapse></a>
103 <dl><dt> <strong>collapse</strong>()</dt><dd>
104 Do not display the groupchildsite component.</p>
108 <a name=method.expand></a>
109 <dl><dt> <strong>expand</strong>()</dt><dd>
110 Display the groupchildsite component.</p>
114 <a name=method.interior></a>
115 <dl><dt> <strong>interior</strong>()</dt><dd>
116 Return the frame within which the programmer may create widgets.
117 This is the same as <code>component('groupchildsite')</code>.</p>
121 <a name=method.toggle></a>
122 <dl><dt> <strong>toggle</strong>()</dt><dd>
123 Display the groupchildsite component if it is currently hidden and
124 hide it if it is currently displayed.</p>
129 <dt> <h3>Example</h3></dt><dd>
130 The image at the top of this manual is a snapshot
131 of the window (or part of the window) produced
132 by the following code.<p></p>
135 def __init__(self, parent):
137 # Create and pack the Groups.
138 w = Pmw.Group(parent, tag_text='label')
139 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
140 cw = Tkinter.Label(w.interior(),
141 text = 'A group with the\ndefault Label tag')
142 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
144 w = Pmw.Group(parent, tag_pyclass = None)
145 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
146 cw = Tkinter.Label(w.interior(), text = 'A group\nwithout a tag')
147 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
150 self.var = Tkinter.IntVar()
152 radioframe = Tkinter.Frame(parent)
153 w = Pmw.Group(radioframe,
154 tag_pyclass = Tkinter.Radiobutton,
155 tag_text='radiobutton 1',
157 tag_variable = self.var)
158 w.pack(fill = 'both', expand = 1, side='left')
159 cw = Tkinter.Frame(w.interior(),width=200,height=20)
160 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
161 radiogroups.append(w)
163 w = Pmw.Group(radioframe,
164 tag_pyclass = Tkinter.Radiobutton,
165 tag_text='radiobutton 2',
166 tag_font = Pmw.logicalfont('Helvetica', 4),
168 tag_variable = self.var)
169 w.pack(fill = 'both', expand = 1, side='left')
170 cw = Tkinter.Frame(w.interior(),width=200,height=20)
171 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
172 radiogroups.append(w)
173 radioframe.pack(padx = 6, pady = 6, expand='yes', fill='both')
174 Pmw.aligngrouptags(radiogroups)
176 w = Pmw.Group(parent,
177 tag_pyclass = Tkinter.Checkbutton,
178 tag_text='checkbutton',
179 tag_foreground='blue')
180 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
181 cw = Tkinter.Frame(w.interior(),width=150,height=20)
182 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
184 w = Pmw.Group(parent,
185 tag_pyclass = Tkinter.Button,
186 tag_text='Tkinter.Button')
187 w.configure(tag_command = w.toggle)
188 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
189 cw = Tkinter.Label(w.interior(),
190 background = 'aliceblue',
191 text = 'A group with\na Button tag!?'
193 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
195 w = Pmw.Group(parent,
196 tag_pyclass = Tkinter.Button,
197 tag_text='Show/Hide')
198 w.configure(tag_command = w.toggle)
199 w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
200 cw = Tkinter.Label(w.interior(),
201 background = 'aliceblue',
202 text = 'Now you see me.\nNow you don\'t.'
204 cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
210 <center><P ALIGN="CENTER">
211 <IMG SRC = blue_line.gif ALT = "" WIDTH=320 HEIGHT=5>
216 <center><P ALIGN="CENTER">
219 - <a href="index.html">Home</a>
220 <br>Manual page last reviewed: 15 November 1998