| 1 | |
| 2 | <html> |
| 3 | <head> |
| 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> |
| 7 | </head> |
| 8 | |
| 9 | <body bgcolor="#ffffff" text="#000000" link="#0000ee" |
| 10 | vlink="551a8b" alink="ff0000"> |
| 11 | |
| 12 | <h1 ALIGN="CENTER">Pmw.Group</h1> |
| 13 | |
| 14 | <center><IMG SRC=Group.gif ALT="" WIDTH=428 HEIGHT=209></center> |
| 15 | <dl> |
| 16 | <dt> <h3>Name</h3></dt><dd> |
| 17 | <p>Pmw.Group() - |
| 18 | frame with ring border and tag |
| 19 | </p> |
| 20 | |
| 21 | |
| 22 | </dd> |
| 23 | <dt> <h3>Inherits</h3></dt><dd> |
| 24 | <a href="MegaWidget.html">Pmw.MegaWidget</a><br> |
| 25 | </dd> |
| 26 | <dt> <h3>Description</h3></dt><dd> |
| 27 | <p> |
| 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 |
| 31 | interior frame.</p> |
| 32 | |
| 33 | <p></p> |
| 34 | |
| 35 | |
| 36 | </dd> |
| 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 |
| 42 | </strong></dt><dd> |
| 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> |
| 45 | |
| 46 | |
| 47 | </dd></dl> |
| 48 | <a name=option.tagindent></a> |
| 49 | <dl><dt> <strong>tagindent |
| 50 | </strong></dt><dd> |
| 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> |
| 53 | |
| 54 | |
| 55 | </dd></dl> |
| 56 | </dd> |
| 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 |
| 62 | </strong></dt><dd> |
| 63 | The frame which can contain other widgets to be grouped. By default, this component is a Tkinter.Frame.</p> |
| 64 | |
| 65 | |
| 66 | </dd></dl> |
| 67 | <a name=component.hull></a> |
| 68 | <dl><dt> <strong>hull |
| 69 | </strong></dt><dd> |
| 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> |
| 73 | |
| 74 | |
| 75 | </dd></dl> |
| 76 | <a name=component.ring></a> |
| 77 | <dl><dt> <strong>ring |
| 78 | </strong></dt><dd> |
| 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> |
| 82 | |
| 83 | |
| 84 | </dd></dl> |
| 85 | <a name=component.tag></a> |
| 86 | <dl><dt> <strong>tag |
| 87 | </strong></dt><dd> |
| 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> |
| 91 | |
| 92 | |
| 93 | </dd></dl> |
| 94 | </dd> |
| 95 | <a name=methods></a> |
| 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>. |
| 101 | <p></p> |
| 102 | <a name=method.collapse></a> |
| 103 | <dl><dt> <strong>collapse</strong>()</dt><dd> |
| 104 | Do not display the groupchildsite component.</p> |
| 105 | |
| 106 | |
| 107 | </dd></dl> |
| 108 | <a name=method.expand></a> |
| 109 | <dl><dt> <strong>expand</strong>()</dt><dd> |
| 110 | Display the groupchildsite component.</p> |
| 111 | |
| 112 | |
| 113 | </dd></dl> |
| 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> |
| 118 | |
| 119 | |
| 120 | </dd></dl> |
| 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> |
| 125 | |
| 126 | |
| 127 | </dd></dl> |
| 128 | </dd> |
| 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> |
| 133 | <pre> |
| 134 | class Demo: |
| 135 | def __init__(self, parent): |
| 136 | |
| 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') |
| 143 | |
| 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') |
| 148 | |
| 149 | radiogroups = [] |
| 150 | self.var = Tkinter.IntVar() |
| 151 | self.var.set(0) |
| 152 | radioframe = Tkinter.Frame(parent) |
| 153 | w = Pmw.Group(radioframe, |
| 154 | tag_pyclass = Tkinter.Radiobutton, |
| 155 | tag_text='radiobutton 1', |
| 156 | tag_value = 0, |
| 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) |
| 162 | |
| 163 | w = Pmw.Group(radioframe, |
| 164 | tag_pyclass = Tkinter.Radiobutton, |
| 165 | tag_text='radiobutton 2', |
| 166 | tag_font = Pmw.logicalfont('Helvetica', 4), |
| 167 | tag_value = 1, |
| 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) |
| 175 | |
| 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') |
| 183 | |
| 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!?' |
| 192 | ) |
| 193 | cw.pack(padx = 2, pady = 2, expand='yes', fill='both') |
| 194 | |
| 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.' |
| 203 | ) |
| 204 | cw.pack(padx = 2, pady = 2, expand='yes', fill='both') |
| 205 | |
| 206 | </pre> |
| 207 | </dd> |
| 208 | </dl> |
| 209 | |
| 210 | <center><P ALIGN="CENTER"> |
| 211 | <IMG SRC = blue_line.gif ALT = "" WIDTH=320 HEIGHT=5> |
| 212 | </p></center> |
| 213 | |
| 214 | |
| 215 | <font size=-1> |
| 216 | <center><P ALIGN="CENTER"> |
| 217 | Pmw 1.2 - |
| 218 | 5 Aug 2003 |
| 219 | - <a href="index.html">Home</a> |
| 220 | <br>Manual page last reviewed: 15 November 1998 |
| 221 | </p></center> |
| 222 | </font> |
| 223 | |
| 224 | </body> |
| 225 | </html> |
| 226 | |